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:


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:


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:


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!


I’m still getting the same error… Do you mind sharing how did it work for you in headless mode and did it work with jenkins?

@kosha Probably because you are using a single hyphen/dash - not two hyphens/dashes -- could be wrong though.
Hopefully that helps from a glance (:

Hi, you need to escape the equal sign, the forum is deleting the backslash in my response:

(Replace the forward for the backslash)

In any case the forum deletes any sign sould be like this:


Hope that works for you.

Hi …it didnt work Call Method ${chrome_options} add_argument -headless/=new

Also it returns blank page here

Call Method ${chrome_options} add_argument -headless/
*** Variables ***
${BROWSER} headlesschrome

My bad, the argument sould be called with double dash like the others you already have.