Chrome options --headless=new

Hi all, I’m trying to run a test case in headless mode with an extension, after checking it is possible by calling the argument like this:

–headless=new

The issue is that I’m using robot like so:

${chrome_options}= Evaluate. sys.modules[‘selenium.webdriver’].CromeOptions() sys, selenium.webdriver


Call Method ${chrome_options}. add_argument. --headless

That works fine and robot runs in headless mode, the issue is when I try to add the “new” paraneter to the “–headless” argument like so:

–headless=new

The error I get is:
Calling method ‘add_argument’ failed: TypeError: ArgOptions.add_argument() got an unexpected keyword argument ‘–headless’

Any idea how to call that argument?

Hi Wilson,

I am trying to understand what you want to do by adding the argument new. Could you please give me more details?

btw this is my options for the setup and teardown:

*** Keywords ***
Begin Web Test
    ${options}  Evaluate  sys.modules['selenium.webdriver'].ChromeOptions()  sys
    Call Method  ${options}  add_argument  --disable-notifications
    Call Method  ${options}  add_argument  --disable-infobars
    Call Method  ${options}  add_argument  --disable-extensions
    Call Method  ${options}  add_argument  --no-sandbox
    Call Method  ${options}  add_argument  --headless
    Call Method  ${options}  add_argument  --disable-dev-shm-usage
    SeleniumLibrary.Open Browser  ${BASE_URL}  Chrome  options=${options}
    SeleniumLibrary.Set Window Size    1920    1080

End Web Test
    SeleniumLibrary.Close Browser

Hi @NikosKoul, my goal was to run the test in headless mode with a chrome extension as an example with salesforceinspector, without the “=new” option, there is no way to open the browser with a chrome extension in headless mode. I was able to fix this by adding the argument in this way:

–headless=new

Thank you for your replay.

1 Like

This is smth I didn’t know it. Perfect!!!
Happy to hear that you fixed it!

Have a nice day!