【问题标题】:Passing a firefox profile to remote webdriver firefox instance not working将 firefox 配置文件传递给远程 webdriver firefox 实例不起作用
【发布时间】:2014-12-04 07:35:28
【问题描述】:

我正在尝试启动 Firefox 的远程 webdriver 实例并传入配置文件。

profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.folderList","2")
self.webdriver = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.FIREFOX,browser_profile=profile)

这不起作用。如果我将它传递给 Firefox webdriver 实例,它可以正常工作

profile = webdriver.FirefoxProfile()
profile.set_preference("browser.download.folderList","2")
self.webdriver = webdriver.Firefox(firefox_profile=profile)

有错误吗?我正在使用 Firefox 9 和 Selenium 2.16

【问题讨论】:

  • 所以这可能是 Selenium 或 Firefox 的错误,已修复。问题是 browser.download.folderList 是一个整数,所以我将它更改为 2 为 int 并且它可以工作。

标签: python selenium grid selenium-webdriver


【解决方案1】:

所以这可能是 Selenium 或 Firefox 的错误,已修复。问题是 browser.download.folderList 是一个整数,所以我将它更改为 2 为 int 并且它可以工作

【讨论】:

    【解决方案2】:

    我对 Selenium 2.39.0 的调用看起来与上面的有点不同。注意 "browser_profile" 作为 .Remote 调用的键,而不是上面使用的 "firefox_profile"。

        profile = webdriver.FirefoxProfile()
        profile.accept_untrusted_certs = True
    
        executor = "https://" + \
            self.env.getSeleniumHub()['ip'] + \
            ":4444/wd/hub"
    
        capabilities = self.env.getSeleniumCapabilities("firefox")
    
        self.driver = webdriver.Remote(
            browser_profile=profile,
            desired_capabilities=capabilities,
            command_executor=executor)
        self.driver.implicitly_wait(10)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-20
      • 2016-11-08
      • 2016-09-14
      • 1970-01-01
      • 2022-12-18
      相关资源
      最近更新 更多