2
from selenium import webdriver

d = webdriver.Chrome("/usr/bin/chromedriver")

d.get("https://google.co.in")


error:
[Running] python -u "/home/nourhene/py/hi.py"
Traceback (most recent call last):
  File "/home/nourhene/py/hi.py", line 11, in <module>
    d = webdriver.Chrome("/usr/bin/chromedriver")
  File "/home/nourhene/.local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/home/nourhene/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/nourhene/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/nourhene/.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/nourhene/.local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
  (Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.4.0-19041-Microsoft x86_64)
4

1 回答 1

2

您在 Windows 上,所以它应该是:

/chromedriver.exe

代替:

/chromedriver
于 2021-05-24T21:06:32.147 回答