0
Selenium + Firefox +擴展用於今天早些時候工作。但我更新FF和硒不再工作(see here),所以我不得不切換到geckodriver。Python - Selenium - 壁虎驅動程序+擴展
我想運行硒(壁虎驅動程序)+ udrive擴展+ quickjava擴展,就像我之前FF更新。
我有以下代碼:
firefox_capabilities = DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
firefox_capabilities['binary'] = '/usr/bin/firefox'
global browser
profile = webdriver.FirefoxProfile()
profile.add_extension("IN/quickjava-2.0.6-fx.xpi")
profile.add_extension("IN/ublock184.xpi")
profile.set_preference("thatoneguydotnet.QuickJava.curVersion", "2.0.6.1") ## Prevents loading the 'thank you for installing screen'
profile.set_preference("thatoneguydotnet.QuickJava.startupStatus.Images", 2) ## Turns images off
profile.set_preference("thatoneguydotnet.QuickJava.startupStatus.AnimatedImage", 2) ## Turns animated images off
browser = webdriver.Firefox(capabilities=firefox_capabilities, firefox_profile=profile)
但是Firefox啓動和運行,而無需任何擴展的,爲什麼?
只需通過創建一個新的Firefox配置文件一次嘗試,在配置文件中添加擴展名並使用該配置文件,創建新的Firefox配置文件,您可以按照我所提到的步驟這篇文章 - http://stackoverflow.com/questions/40878504/how-to-use-acceptsslcerts-with-remotewebdriver/40881502#40881502 –