简体   繁体   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 () got an unexpected keyword argument 'options' TypeError: init () 得到了一个意外的关键字参数 'options'

Selenium package version == 3.141.0硒包版本 == 3.141.0

The same code was working fine till 1 day back.相同的代码运行良好,直到 1 天前。 I suspect some other dependant package upgrade might have screwed it up.我怀疑其他一些依赖包升级可能把它搞砸了。

Apparently this is what fixed it:显然这是修复它的原因:

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.

相关问题 TypeError:__init __()获得了意外的关键字参数'options' - TypeError: __init__() got an unexpected keyword argument 'options' TypeError at '' __init__() 得到一个意外的关键字参数 '' - TypeError at '' __init__() got an unexpected keyword argument '' TypeError: WebDriver.__init__() 在 Selenium ZA7F5F35426B927411FC9231B56382173 中使用 firefox_options 作为 arguments 时出现意外关键字参数“firefox_options”错误 - TypeError: WebDriver.__init__() got an unexpected keyword argument 'firefox_options' error using firefox_options as arguments in Selenium Python Python TypeError:__init __()获得了意外的关键字参数'serialized_options' - Python TypeError: __init__() got an unexpected keyword argument 'serialized_options' Tensorboard TypeError:__init__() 得到了一个意外的关键字参数“serialized_options” - Tensorboard TypeError: __init__() got an unexpected keyword argument 'serialized_options' TypeError: __init__() 在使用 EdgeOptions 时得到了一个意外的关键字参数 'options' - TypeError: __init__() got an unexpected keyword argument 'options' while using EdgeOptions Selenium TypeError: __init__() 得到了一个意外的关键字参数 'service' - Selenium TypeError: __init__() got an unexpected keyword argument 'service' TypeError: __init__() 使用 Python Selenium ChromeDriver 和公司 pac 文件时出现意外的关键字参数“服务”错误 - TypeError: __init__() got an unexpected keyword argument 'service' error using Python Selenium ChromeDriver with company pac file Scrapy错误:TypeError:__ init __()得到一个意外的关键字参数'deny' - Scrapy Error: TypeError: __init__() got an unexpected keyword argument 'deny' TypeError:__init __()得到了意外的关键字参数错误 - TypeError: __init__() got an unexpected keyword argument error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM