Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set "debuggerAddress" chromeOption via selenium-webdriver javascript API?

There is a list of recognized "capabilities" in Webdriver and "debuggerAddress" is among them.

But I can't find a way to set such option neither in Capabilities class not in CromeOptions in javascript api.

As I can see in several questions "debuggerAddress" option (or capability?) is possible to set in Python api.

What I try is similar to this question, from node app

  1. To link app to already started webdriver (cromedriver.exe). This is ok with

    webdriver.Builder().usingServer( 'http://localhost:9515' )

  2. Ask webdriver not to start new Chrome instance but instead to link to already started with --remote-debugging-port=XXXXX Chrome parameter. And this should be done with "debuggerAddress" option/capability, but I can't realize how to do it with javascript api.

like image 979
Dima Fomin Avatar asked Mar 13 '23 22:03

Dima Fomin


1 Answers

It appears there is no API exposed for that. But I managed to get it to work using this hack:

    var chrome = require("selenium-webdriver/chrome");
    var options = new chrome.Options();
    options.options_["debuggerAddress"] = "127.0.0.1:6813";
    var driver = new webdriver.Builder()
        .forBrowser('chrome')
        .setChromeOptions(options)
        .build();

See this for the full basic example.

like image 98
Sergey Avdeev Avatar answered Mar 15 '23 13:03

Sergey Avdeev