相关疑难解决方法(0)

无法使用 Selenium Webdriver。得到两个异常

尝试使用 Selenium Webdriver 创建对象时出现以下错误。

"\selenium\webdriver\common\driver_finder.py", line 42, in get_path
    path = SeleniumManager().driver_location(options) if path is None else path

"\selenium\webdriver\common\selenium_manager.py", line 74, in driver_location
    browser = options.capabilities["browserName"]

AttributeError: 'str' object has no attribute 'capabilities'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
"\selenium_webdriver_webscraping.py", line 4, in <module>
    driver = webdriver.Chrome(chrome_driver_path)
"\selenium\webdriver\chrome\webdriver.py", line 47, in __init__
    self.service.path = DriverFinder.get_path(self.service, self.options)
"\selenium\webdriver\common\driver_finder.py", line 44, in get_path
    raise NoSuchDriverException(f"Unable to obtain {service.path} using Selenium Manager; {err}")
selenium.common.exceptions.NoSuchDriverException: Message: …
Run Code Online (Sandbox Code Playgroud)

python exception selenium-chromedriver selenium-webdriver

10
推荐指数
2
解决办法
9万
查看次数