Python : Selenium - Message: unknown error: Chrome failed to start: exited abnormally

余生长醉 提交于 2020-02-08 05:11:14

问题


I am trying to start chrome driver in Linux 3.10.0-327.36.3.el7 using selenium with python. Also got some useful help from the chrome documentation, my extract code snippet is

chromedriver = "/path/to/bin/chromedriver"
os.environ["webdriver.chrome.driver"] = chromedriver
driver = webdriver.Chrome(chromedriver,
              service_log_path = service_log_path, service_args=service_args)

But I am getting the error message below,

Message: unknown error: Chrome failed to start: exited abnormally (Driver info: chromedriver=2.29.461571 (8a88bbe0775e2a23afda0ceaf2ef7ee74e822cc5),platform=Linux 3.10.0-327.36.3.el7

I dont see a problem in the code (as far as I know), please help me with some fix.


回答1:


Not sure if you made your chromedriver executable ( on a Ubuntu/Linux/Mac system). If you didn't do that, your chromedriver wouldn't work.

Please try this - if you haven't

 chmod +x chromedriver

 chmod 777 chromedriver

And then try again. I wrote a simple script for this and I was able to get my chrome started perfectly -

import os
from selenium import webdriver

chrome_path="/home/rahul/Documents/SeleniumPy/chromedriver" //this is my chromedriver path

driver=webdriver.Chrome(chrome_path)

driver.maximize_window()

driver.implicitly_wait(30)
driver.get('http://www.google.com')

driver.quit()


来源:https://stackoverflow.com/questions/43354429/python-selenium-message-unknown-error-chrome-failed-to-start-exited-abnor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!