【问题标题】:(Selenium ruby) How to add debuggerAddress experimental option?(Selenium ruby​​) 如何添加 debuggerAddress 实验选项?
【发布时间】:2017-07-30 13:03:37
【问题描述】:

说明

我想将 selenium 附加到现有的 chrome 会话,然后使用我的 chrome 配置文件调整页面,但从终端 我发现这是feasible using debuggerAddress

摘录-

Launch Chrome from command prompt:
chrome.exe --remote-debugging-port=8181

Sample Code:
        ChromeOptions options = new ChromeOptions();
        options.setExperimentalOption("debuggerAddress", "127.0.0.1:8181");

        WebDriver driver = new ChromeDriver(options);
        driver.manage().timeouts().implicitlyWait(1, TimeUnit.MINUTES);
        driver.get("http://www.google.com");
        driver.findElement(By.name("q")).sendKeys("test");
        driver.quit();

重现步骤 -

// close all chrome windows
$ google-chrome-stable --remote-debugging-port=4444
// chrome opened with my profile
$ pry
>  require 'selenium-webdriver'
>  Selenium::WebDriver::Chrome.path = '/usr/bin/google-chrome-stable'
>  Selenium::WebDriver::Chrome.driver_path = '/usr/bin/chromedriver'
>  options = Selenium::WebDriver::Chrome::Options.new
>  # options.add_experimental_option("debuggerAddress", "127.0.0.1:4444") # how????
>  driver = Selenium::WebDriver.for :chrome, options: options

【问题讨论】:

    标签: selenium selenium-chromedriver


    【解决方案1】:

    ruby 客户端没有add_experimental_option

    改用add_option

    options = Selenium::WebDriver::Chrome::Options.new
    options.add_option("debuggerAddress", "127.0.0.1:4444")
    

    【讨论】:

      猜你喜欢
      • 2016-06-30
      • 2021-07-24
      • 2017-12-29
      • 1970-01-01
      • 1970-01-01
      • 2018-05-27
      • 2014-01-01
      • 2014-06-14
      • 1970-01-01
      相关资源
      最近更新 更多