首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何通过selenium-webdriver设置"debuggerAddress“chromeOption?

如何通过selenium-webdriver设置"debuggerAddress“chromeOption?
EN

Stack Overflow用户
提问于 2016-03-15 11:07:52
回答 2查看 7.9K关注 0票数 6

Webdriver中有一个公认的“能力”列表,"debuggerAddress“就是其中之一。

但是我找不到一种方法来设置这样的选项,无论是在能力类中还是在javascript的CromeOptions中。

正如我在几个问题中看到的"debuggerAddress“选项(或功能?)可以在Python中设置。

我尝试的类似于这个问题,来自节点应用程序。

  1. 将应用程序链接到已经启动的webdriver (cromedriver.exe)。这个没问题 webdriver.Builder().usingServer( 'http://localhost:9515' )
  2. 请webdriver不要启动新的Chrome实例,而是用--remote-debugging-port=XXXXX Chrome参数链接到已经启动的浏览器。这应该用"debuggerAddress"选项/功能来完成,但我不知道如何使用javascript。
EN

Stack Overflow用户

发布于 2022-09-20 06:20:12

在使用选项--remote-debugging-port=9222运行Chrome之后,使用chromeDriver105号,我让它使用chrome.Options()debuggerAddress()方法,如下所示:

代码语言:javascript
运行
复制
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");

希望它有帮助:)

票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36009528

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档