python selenuim TypeError: WebDriver.

02-27 阅读 0评论

Python selenuim TypeError: WebDriver.__init__() got an unexpected keyword argument 'chrome_options'

运行客户端:Pycharm 

python selenuim TypeError: WebDriver.,python selenuim TypeError: WebDriver.,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,错误,.com,公众号,第1张
(图片来源网络,侵删)

运行程序如下:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
wd = webdriver.Chrome(chrome_options=options, executable_path=r'c:\chromedriver\chromedriver.exe')

Run之后出现的.com/index.php/tags-9785.html" class="superseo">错误如下。

TypeError: WebDriver.__init__() got an unexpected keyword argument 'chrome_options'/'executable_path'

在Anaconda里面是可以运行成功的,所以由此我们查询了其selenium版本。

python selenuim TypeError: WebDriver.

而此时在Pycharm中,selenium的版本是 4.15.2的新版本,包括urllib3的版本。

python selenuim TypeError: WebDriver.

解决方案:

一、统一变成低版本 可直接运行代码的版本。

python selenuim TypeError: WebDriver.

python selenuim TypeError: WebDriver.,python selenuim TypeError: WebDriver.,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,错误,.com,公众号,第5张
(图片来源网络,侵删)

python selenuim TypeError: WebDriver.

​​​​​​参阅:Selenium |AttributeError: 'WebDriver' object has no attribute 'find_element_by_class_name' - 老表爱技术https://www.cnblogs.com/rychh/p/17146472.html

 

二、维持Pycharm中版本不变,改代码去适应新版本的需求。

import time,os,re
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
service = Service(executable_path=r'c:\chromedriver\chromedriver.exe)
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(service=service, options=options)
#......
driver.quit()
可参阅:
https://stackoverflow.com/questions/76550506/typeerror-webdriver-init-got-an-unexpected-keyword-argument-executable-p

萌新公众号 欢迎关注。

python selenuim TypeError: WebDriver.

python selenuim TypeError: WebDriver.,python selenuim TypeError: WebDriver.,词库加载错误:未能找到文件“C:\Users\Administrator\Desktop\火车头9.8破解版\Configuration\Dict_Stopwords.txt”。,错误,.com,公众号,第8张
(图片来源网络,侵删)

免责声明
本网站所收集的部分公开资料来源于AI生成和互联网,转载的目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。
文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

发表评论

快捷回复: 表情:
评论列表 (暂无评论,人围观)

还没有评论,来说两句吧...

目录[+]