将Firefox配置文件传递给远程Webdriver Firefox实例无法工作

6
我正试图启动一个远程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是一个整数,所以我将它改为int 2,现在它可以工作了。 - Bob Evans
2个回答

2

所以这可能是Selenium或Firefox的一个bug,已经被修复。问题在于browser.download.folderList是一个整数,所以我将它改为int 2,然后它就可以工作了。


0

我的Selenium 2.39.0的调用与上面的稍有不同。请注意".Remote"调用中"browser_profile"作为关键字,而不是上面使用的"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)

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接