Python:Selenium - 消息:未知错误:Chrome无法启动:异常退出

时间:2022-10-20 18:21:11

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

我正在尝试使用selenium和python在Linux 3.10.0-327.36.3.el7中启动chrome驱动程序。还从chrome文档中获得了一些有用的帮助,我的解压缩代码片段是

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

消息:未知错误:Chrome无法启动:异常退出(驱动程序信息: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 个解决方案

#1


-2  

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.

不确定你是否使用了chromedriver可执行文件(在Ubuntu / Linux / Mac系统上)。如果你没有这样做,你的镀铬机将不起作用。

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 -

然后再试一次。我为此写了一个简单的脚本,我能够完美地启动我的chrome -

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()

#1


-2  

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.

不确定你是否使用了chromedriver可执行文件(在Ubuntu / Linux / Mac系统上)。如果你没有这样做,你的镀铬机将不起作用。

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 -

然后再试一次。我为此写了一个简单的脚本,我能够完美地启动我的chrome -

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()