Selenium在mac上运行时出现问题



这段代码在windows上运行良好,但在mac上它会给我这个错误。

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 973, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/python@3.9/3.9.7/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "/Users/shh/Desktop/gen/app.py", line 467, in worker
account(item, password)
File "/Users/shh/Desktop/gen/app.py", line 159, in account
browser = webdriver.Chrome(service=service, options=chrome_options)
TypeError: __init__() got an unexpected keyword argument 'service'

我得到它的工作通过删除服务选项,只是添加路径到chromedriver。

browser = webdriver.Chrome('/usr/local/bin/chromedriver', options=chrome_options)

最新更新