我有一个脆弱的刮问题,在我的手中有很多的JavaScript创建会话相关的cookie,我试图绕过这个问题使用硒。我正在使用python驱动程序(python-selenium,版本为2.2.0-1)。如果没有从selenium-server-standalone-2.39.0.jar获得的远程驱动程序,浏览器开始工作,但不工作(报告了一些配置文件问题)。使用远程驱动程序的一切只是set_preference不工作是好的(我需要为了定义一个browser_profile能够自动保存一些文件):Firefox的set_preference通过远程驱动程序不工作
profile = webdriver.FirefoxProfile()
profile.set_preference('browser.download.folderList', 2) # custom location
profile.set_preference('browser.download.manager.showWhenStarting', False)
profile.set_preference('browser.download.dir', '/tmp')
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'application/pdf')
profile.set_preference('browser.helperApps.neverAsk.saveToDisk', 'application/pdf')
#browser = webdriver.Firefox()
browser = webdriver.Remote(
command_executor='http://127.0.0.1:4444/wd/hub',
desired_capabilities=DesiredCapabilities.FIREFOX, browser_profile=profile)
这样不仅对话框,保存/打开选项打开但检查about:config我没有找到已设置的conf。 在这个debian上我有Iceweasel 24.2.0,但我也尝试过使用普通firefox的Ubuntu,没有运气。
任何想法可能是我的问题?
使用我的Iceweasel配置文件确实奏效,谢谢。这将是有趣的,找出为什么set_preference不起作用,但现在对我来说没关系:) – vodka