繁体   English   中英

Selenium Firefox:TypeError:__init__() 得到了一个意外的关键字参数“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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM