Chrome crashes when selenium launches a website

Chrome crashes when selenium launches a website

Problem Description:

I am trying to open a website on chrome via selenium with the following code:

from selenium import webdriver
from import Service

browser = webdriver.Chrome(service=s)

link to problem:

Solution – 1

This is not an issue or crash. After the specified actions are completed successfully, selenium closes the web browser. This program works fine.

Use the following code with a while True block

from import Options 
chrome_options = Options()
chrome_options.add_experimental_option("detach", True)

Solution – 2

This isn’t any crash or an error as such. Selenium automatically closes the client i.e. the Chrome Browser instance after executing the last line of your code. However this practice may accumulate undeleted/zombie chromedriver instances within your system.

Ideally, you always need to invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully at the end of your tests.

Solution – 3

the chromedrive path in your code, i guess your platform is windows.

but the picture you post revease that your machine is mac.

pay attention to the chromedriver file PATH and your PC platform, make sure they suit to each other.

or you could put chromedriver in system PATH variable, so you do not need to specify the chromedrive path in your code

Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.