【问题标题】:Selenium having issues running on mac. Error unexpected argument serviceSelenium 在 Mac 上运行时出现问题。错误的意外参数服务
【发布时间】:2021-11-03 04:31:05
【问题描述】:

此代码在 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'

【问题讨论】:

    标签: python macos selenium


    【解决方案1】:

    我通过删除服务选项并仅添加 chromedriver 的路径来使其正常工作。

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

    【讨论】:

      猜你喜欢
      • 2015-12-23
      • 1970-01-01
      • 1970-01-01
      • 2020-01-13
      • 2020-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-06
      相关资源
      最近更新 更多