Hi, I’m new to robotframework and Playwright. I installed
robotframework browser library
VS code with Robot Framework language server extension
I can run following sample test successfully in headless mode. But how can I run it in headed mode, i.e. showing browser UI?
*** Settings ***
Library Browser
*** Test Cases ***
Run Test
New Page https://playwright.dev
Get Text h1 contains Playwright
*** Settings ***
Library Browser
*** Test Cases ***
Run Test
New Browser headless=False
New Page https://playwright.dev
Get Text h1 contains Playwright
Hi Dave,
Thanks for the solution. What if the test suite needs to be executed in both headed and headless mode, and the condition is defined outside of the script, say, via env or CLI argument?
*** Settings ***
Library Browser
*** Variables ***
${HEADLESS} ${True}
*** Test Cases ***
Run Test
New Browser headless=${HEADLESS}
New Page https://playwright.dev
Get Text h1 contains Playwright
Now it defaults to headless (or defaults to headed if you set it False), which you can override on the command line with the -v or --variable option, like this: