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

2

6

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.

Itin answered 15/3, 2016 at 11:7 Comment(0)
M
8

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.

Mooring answered 7/2, 2017 at 16:39 Comment(1)
This is the only solution I have found that works.Amphibrach
Y
2

After running Chrome with option --remote-debugging-port=9222, with chromedriver 105 I got it working with debuggerAddress() method of chrome.Options(), like this:

const webdriver = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
var chromeOptions = new chrome.Options();
chromeOptions.debuggerAddress("127.0.0.1:9222");
var driver = await new webdriver.Builder().forBrowser("chrome").setChromeOptions(chromeOptions).build();

await driver.get("https://www.google.com");

Hope it helps :)

Young answered 20/9, 2022 at 6:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.