繁体   English   中英

将firefox配置文件传递给远程webdriver firefox实例无法正常工作

[英]Passing a firefox profile to remote webdriver firefox instance not working

我正在尝试启动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)

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

所以这是一个已经修复的Selenium或Firefox的错误。 问题是browser.download.folderList是一个整数,所以我将它改为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)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM