Selenium.common.exceptions.WebDriverException:Message:Service Chromium-browser Unexpectedly exited

Source: Internet
Author: User

Python novice. Today in learning python to open Chrome browser using selenium and Webdriver, I encountered two problems

From selenium import webdriver
browser = webdriver.chrome ("Chromium-browser")
browser.get ("http://www.baidu.com")

Then the error is as follows:

Traceback (most recent call last):
File "test.py", line 3, in < module >
Browser = Webdriver. Chrome ("Chromium-browser")
File "/usr/lib/python2.7/selenium/webdriver/chrome/webdriver.py", line, in _ Init_
Self.service.start ()
File "/usr/lib/python2.7/selenium/webdriver/common/service.py", line, in start
Self.assert_process_still_running ()
File "/usr/lib/python2.7/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
% (Self.path, Return_code)
Selenium.common.exceptions.WebDriverException:Message:Service Chromium-browser unexpectedly exited. Status Code was:0

The reason for this mistake is webdriver. Chrome ("Chromium-browser"), the parameters should not be Chrome browser, but should be chromedriver, so download chromedriver can, my system is Ubuntu 14.04, download decompression after the move to/usr/ Bin directory.

A new problem is encountered when you change the following:

From selenium import webdriver
browser = webdriver.chrome ("Chromedriver")
browser.get ("http://www.baidu.com ")

Traceback (most recent call last):
File "test.py", line 4, in < module>
Browser.get (' http://www.baidu.com ')
File "/usr/lib/python2.7/selenium/webdriver/remote/webdriver.py", line 264, in get
Self.execute (command.get, {' url ': url})
File "/usr/lib/python2.7/selenium/webdriver/remote/webdriver.py", line 252, in Execute
Self.error_handler.check_response (response)
File "/usr/lib/python2.7/selenium/webdriver/remote/errorhandler.py", line 194, in Check_response
Raise Exception_class (message, screen, stacktrace)
Selenium.common.exceptions.WebDriverException:Message:unknown error:unhandled Inspector Error: {"code":-32603, " Message ': ' cannot navigate to invalid URL}
(Session info:chrome=49.0.2623.108)
(Driver info:chromedriver=2.9.248304,platform=linux 3.16.0-30-generic x86_64)

Do not know the specific reasons, welcome to know the friend to tell, on Google saw a friend write code, tried, the result of the problem solved, successfully opened the page.

import os from selenium import webdriver chromedriver = "/usr/bin/chromedriver" Webdriver.chrome.driver "] = chromedriver browser = webdriver. Chrome (' Chromedriver ') browser.get (' http://www.baidu.com ') 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.