从Chrome位置C:\ .. \ Chrome \ Application \ chrome.exe开始的进程不再运行,因此ChromeDriver假定Chrome已崩溃 [英] The process started from chrome location C:\..\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed

查看:1499
本文介绍了从Chrome位置C:\ .. \ Chrome \ Application \ chrome.exe开始的进程不再运行,因此ChromeDriver假定Chrome已崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Chrome版本:68.0.3440.106
Chrome网络驱动程序版本:ChromeDriver 2.41.578737
Python版本:Python 3.5.2

Chrome version: 68.0.3440.106
Chrome webdriver version: ChromeDriver 2.41.578737
Python Version : Python 3.5.2

我用python编写此代码:

I write this code in python:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys


o = webdriver.ChromeOptions()
o.add_argument("disable-extensions");
o.add_argument("--start-maximized");
driver = webdriver.Chrome(executable_path=r"chromedriver.exe",options=o)
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()

几秒钟后,chrome打开,并显示以下错误:

after few seconds chrome opened with this error:


在关闭chrome并获得此异常之前,什么也没有发生:


and nothing happend till i close chrome and get this exception:

    Traceback (most recent call last):
  File ".../game.py", line 8, in <module>
    driver = webdriver.Chrome(executable_path=r"chromedriver.exe",options=o)
  File "...\Python\Python35-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 75, in __init__
    desired_capabilities=desired_capabilities)
  File "...\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 156, in __init__
    self.start_session(capabilities, browser_profile)
  File "...\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 251, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "...\Python\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute
    self.error_handler.check_response(response)
  File "...\Python\Python35-32\lib\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: exited normally
  (unknown error: unable to discover open pages)
  (The process started from chrome location C:\Program Files (x86)\Google\Chrome\Application\chrome.exe is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)

推荐答案

今天,我遇到了同样的麻烦,并且使用以下方法解决了问题:

Today I was the same trouble and I fixed using:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys


o = webdriver.ChromeOptions()
o.add_argument("disable-extensions")
o.add_argument("--start-maximized")
o.binary_location = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" ## This line define path of browser. In this case, Google Chrome
driver = webdriver.Chrome(executable_path=r"chromedriver.exe",options=o)
driver.get("http://www.python.org")
assert "Python" in driver.title
elem = driver.find_element_by_name("q")
elem.clear()
elem.send_keys("pycon")
elem.send_keys(Keys.RETURN)
assert "No results found." not in driver.page_source
driver.close()

这篇关于从Chrome位置C:\ .. \ Chrome \ Application \ chrome.exe开始的进程不再运行,因此ChromeDriver假定Chrome已崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆