问题
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