首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >seleniumwire_options=None: SyntaxError:无效语法

seleniumwire_options=None: SyntaxError:无效语法
EN

Stack Overflow用户
提问于 2019-05-24 22:08:13
回答 1查看 1.4K关注 0票数 0

我使用selenium-wire在Chrome浏览器上点击一个按钮。直到今天,我的代码都运行得很好。但是,现在我得到了以下错误,但我不确定原因:

代码语言:javascript
复制
Traceback (most recent call last):
File "Scraping_fx.py", line 1, in <module>
from seleniumwire import webdriver
File "C:\Users\me\Anaconda3\envs\project\lib\site- 
packages\seleniumwire\webdriver\__init__.py", line 3, in <module>
from .browser import Chrome, Edge, Firefox, Safari  # noqa
File "C:\Users\me\Anaconda3\envs\project\lib\site- 
packages\seleniumwire\webdriver\browser.py", line 14
def __init__(self, *args, seleniumwire_options=None, **kwargs):
                                             ^
SyntaxError: invalid syntax

我使用的是python 2.7.16;selenium-wire 1.0.4。

代码语言:javascript
复制
from seleniumwire import webdriver
from selenium.common.exceptions import ElementClickInterceptedException,NoSuchElementException
import logging

def scrape_website(url):

    # Configure browser driver
    options = webdriver.ChromeOptions()
    options.add_argument('--no-sandbox')
    options.add_argument('--disable-gpu')
    options.add_argument('--headless')

    #Instantiate driver and navigate to URL
    driver = webdriver.Chrome(chrome_options=options)
    driver.implicitly_wait(30)
    driver.get(url)

我是不是漏掉了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-24 23:13:26

我看不出你的代码有什么问题:)但是selenium-wire 1.0.4需要Python 3.4+。

你可以在pypi.org - here上找到所有的信息

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56294334

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档