javascript - 如何通过 selenium-webdriver javascript API 设置 "debuggerAddress"chromeOption?

标签 javascript google-chrome selenium-webdriver selenium-chromedriver browser-testing

有一个列表recognized "capabilities"在 Webdriver 中,“debuggerAddress”就在其中。

但我在 Capabilities 中都找不到设置此类选项的方法类不在 CromeOptions在 JavaScript API 中。

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

我尝试的类似于 this question , 来自节点应用

  1. 将应用链接到已经启动的 webdriver (cromedriver.exe)。这没关系

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

  2. 使用 --remote-debugging-port=XXXXX Chrome 参数要求 webdriver 不要启动新的 Chrome 实例,而是链接到已经启动的 Chrome 实例。这应该通过 "debuggerAddress" 选项/功能来完成,但我不知道如何使用 javascript api 来完成。

最佳答案

似乎没有为此公开的 API。但是我设法使用这个 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();

参见 this完整的基本示例。

关于javascript - 如何通过 selenium-webdriver javascript API 设置 "debuggerAddress"chromeOption?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36009528/

相关文章:

javascript - 我通过 JQuery 单击显示了一堆图像 - 有什么简单的方法可以制作动画吗?

javascript - 从浏览器的网络控制台获取信息

google-chrome - list 无效 json 错误

c# - Selenium C# Firefox 22 - 来自网络的 "silent save file"不再工作

java - 无法点击 'Text' 内的 'dropdown list'

javascript - 如何在 Angular 指令中调用我自己的函数?

javascript - react-spring - 在内容变化时为 <p> 元素设置动画

javascript - 我应该在 GraphQL 中使用列表(数组)吗?

javascript - 打开数据:text/plain window in chrome showing up blank

java.io.IOException : The filename, 目录名或卷标语法不正确