简体   繁体   English

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

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

I'm trying to start up a remote webdriver instance of Firefox and pass in a profile. 我正在尝试启动Firefox的远程webdriver实例并传入配置文件。

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

this is not working. 这不起作用。 If I pass it into the Firefox webdriver instance it works fine 如果我将它传递到Firefox webdriver实例,它可以正常工作

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

Is there a bug? 有bug吗? I'm using Firefox 9 and Selenium 2.16 我正在使用Firefox 9和Selenium 2.16

So this was either a bug with Selenium or Firefox that has been fixed. 所以这是一个已经修复的Selenium或Firefox的错误。 Problem is that browser.download.folderList is an integer, so I changed it 2 to int and it works 问题是browser.download.folderList是一个整数,所以我将它改为2并且它有效

My call with Selenium 2.39.0 looks a little different than what's above. 我对Selenium 2.39.0的调用与上面的内容略有不同。 Note "browser_profile" as the key for the .Remote call, instead of "firefox_profile" used above. 注意“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