cancel
Showing results for 
Search instead for 
Did you mean: 
Get Started Discussions
Start your journey with Databricks by joining discussions on getting started guides, tutorials, and introductory topics. Connect with beginners and experts alike to kickstart your Databricks experience.
cancel
Showing results for 
Search instead for 
Did you mean: 

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.

AleksandraFrolo
New Contributor III

Hiiiii,

I want to scratch a text from the web page with simple code:

from selenium import webdriver

# Set options to make browsing easier

#Function is responsible to create a driver and return that driver.
def get_driver():
    chrome_options = webdriver.ChromeOptions()
    chrome_options.add_argument("start-maximized")
    chrome_options.add_argument("disable-infobars")
    chrome_options.add_argument("disable-dev-shm-usage")
    chrome_options.add_argument("no-sandbox")
    chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
    chrome_options.add_argument("disable-blink-features=AutomationControlled")
    

    driver = webdriver.Chrome(options = chrome_options)

    #connect driver to a web page
    driver.get("http://automated.pythonanywhere.com")
    #return driver for this particular web page
    return driver

def main():
    driver = get_driver()
    element = driver.find_element(by = "xpath", value = "/html/body/div[1]/div/h1[1]")
    return element.text

print(main())

The error message:

WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /root/.cache/selenium/chrome/linux64/115.0.5790.170/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Stacktrace:
#0 0x55e176cd1613 
#1 0x55e1769fd537 
#2 0x55e176a28588 
#3 0x55e176a255d9 
#4 0x55e176a65643 
#5 0x55e176a64d8f 
#6 0x55e176a5c803 
#7 0x55e176a3068b 
#8 0x55e176a3142e 
#9 0x55e176c92c28 
#10 0x55e176c96af7 
#11 0x55e176ca101c 
#12 0x55e176c97723 
#13 0x55e176c66457 
#14 0x55e176cbb628 
#15 0x55e176cbb7b7 
#16 0x55e176cca483 
#17 0x7efedfacc609 start_thread
---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
<command-1651202861729537> in <cell line: 6>()
      4     return element.text
      5 
----> 6 print(main())

<command-1651202861729537> in main()
      1 def main():
----> 2     driver = get_driver()
      3     element = driver.find_element(by = "xpath", value = "/html/body/div[1]/div/h1[1]")
      4     return element.text
      5 

<command-1651202861729536> in get_driver()
     12 
     13 
---> 14     driver = webdriver.Chrome(options = options)
     15 
     16     #connect driver to a web page

Can you explain what does this error mean and how can I solve it?

1 REPLY 1

Debayan
Esteemed Contributor III
Esteemed Contributor III

Hi, Looks like the issue is with your browser, could you please try to change the browser and confirm?

Please tag @Debayan with your next comment, which will get me notified. Thanks!

Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!