python selenium headless chrome chromedriver 等安装

python selenium 略

chrome:

https://blog.csdn.net/zhuyiquan/article/details/79537623

6及以下版本不适用 6及以下版本不适用 6及以下版本不适用 6及以下版本不适用 6及以下版本不适用

欢迎大胆尝试,如果能用,求一定此处留名

由于key的原因安装失败,见↓

https://www.google.com/linuxrepositories/

chromedriver:

存放路径建议在: /usr/bin/{HERE}

或者代码里指定路径:

webdriver.Chrome(executable_path=path


验证整体是否可用了:

https://blog.csdn.net/dengyike1023/article/details/79014775



遇到的问题:

Traceback (most recent call last):

  File "step1.py", line 12, in <module>

    driver = webdriver.Chrome(executable_path=path,chrome_options=option)

  File "/usr/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 75, in __init__

    desired_capabilities=desired_capabilities)

  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 156, in __init__

    self.start_session(capabilities, browser_profile)

  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 245, in start_session

    response = self.execute(Command.NEW_SESSION, parameters)

  File "/usr/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 314, in execute

    self.error_handler.check_response(response)

  File "/usr/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.38.552522 (437e6fbedfa8762dec75e2c5b3ddb86763dc9dcb),platform=Linux 3.10.0-514.16.1.el7.x86_64 x86_64)


https://github.com/SeleniumHQ/selenium/issues/4961

加  --no-sandbox



阅读更多

没有更多推荐了,返回首页