[英]TypeError: __init__() got an unexpected keyword argument 'options'
[英]Selenium Firefox : TypeError: __init__() got an unexpected keyword argument 'options'
from selenium.webdriver.chrome.options import Options
from selenium.webdriver import DesiredCapabilities
from selenium.webdriver.common.proxy import Proxy, ProxyType
from selenium.webdriver.firefox.options import Options as Firefox_Options
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
firefox_options = Firefox_Options()
if headless_browser:
firefox_options.add_argument('-headless')
if browser_profile_path is not None:
firefox_profile = webdriver.FirefoxProfile(
browser_profile_path)
else:
firefox_profile = webdriver.FirefoxProfile()
# set English language
firefox_profile.set_preference('intl.accept_languages', 'en')
if disable_image_load:
# permissions.default.image = 2: Disable images load,
# this setting can improve pageload & save bandwidth
firefox_profile.set_preference('permissions.default.image', 2)
if proxy_address and proxy_port:
firefox_profile.set_preference('network.proxy.type', 1)
firefox_profile.set_preference('network.proxy.http',
proxy_address)
firefox_profile.set_preference('network.proxy.http_port',
proxy_port)
firefox_profile.set_preference('network.proxy.ssl',
proxy_address)
firefox_profile.set_preference('network.proxy.ssl_port',
proxy_port)
browser = webdriver.Firefox(firefox_profile=firefox_profile,
options=firefox_options)
TypeError: init () 得到了一個意外的關鍵字參數 'options'
硒包版本 == 3.141.0
相同的代碼運行良好,直到 1 天前。 我懷疑其他一些依賴包升級可能把它搞砸了。
顯然這是修復它的原因:
sudo chown -R $USER /usr/local/lib/python3.6
sudo chown -R $USER /Users/ishandutta2007/.pyenv
pip uninstall urllib3
pip uninstall selenium
pip install --upgrade git+https://github.com/socialbotspy/SocialCommons.git
pip install -r requirements.txt
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.