Forum Discussion

RichardPla's avatar
Occasional Contributor
10 months ago

Setting browser options programmatical

Why I cannot set browser options (e.g. chrome) using this javascript code:'


Browsers.Item("chrome").RunOptions = '--incognito';
Browsers.Item("chrome").RunOptions = '--headless';


Tried using this code:


var browserOptions = {
                                            'args': [


in conjunction w this code:


Browsers.RemoteItem(server, browserOptions ).Run();


Still no joy - am I trying something that is impossible?...





2 Replies

  • rraghvani's avatar
    Champion Level 3

    In JavaScript it's,


    Browsers.Item(btChrome).RunOptions = "-incognito"
    Browsers.Item(btEdge).RunOptions = "-inprivate"



    • RichardPla's avatar
      Occasional Contributor

      Thanks, but you reply is not sufficient.


      1. 1. You might want to consider updating you documentation with that info as it is not immediately obvious that specifying Chrome options requires just one hyphen (“-“) instead of “—”, which is a standard (see )that you follow in you documentation on page in paragraph “Command-line arguments”.
      3. 2. You did NOT address the headless mode of browser operation, which happens to be far more important to my organization. This line of code:

      Browsers.Item(btChrome).RunOptions = '-incognito';


      does not alter the behavior of the browser, which still shows full UI after starting.


      I have tried (rightly or wrongly) an alternative approach based on you documentation ( ). Here, again, is my code:

        var url = "";

        var capabilities = {

                              "browserName": "chrome",

                              "goog:chromeOptions": {

                                                                "args": [







        Browsers.RemoteItem(“localhost”, capabilities).Run(url);


       When executed it terminates with this error:


       even though the latest version of chromedriver is present in “C:\ProgramData\SmartBear\WebDrivers\chrome” folder (as per your documentation – “<ProgramData>\SmartBear\WebDrivers\<browser> “).


      Can you please either tell me what am I doing wrong when specifying “headless” mode as  a simple run option, or explain what is wrong with my code related to the Browser.RemoteItem command.