Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Added on April 5, 2023 9:57AM
Likes: 0
Replies: 1
Hello,
I opened a WebDriver Session using Selenium but when I ran the recipe there was an exception and the recipe failed which means that the code where I quit the session hasn't been executed. Now I have multiple Webdriver sessions open but I don't know how to retrieve them and close them. Is there someone who can help with that?
Hi @marie790
,
You should always try and except in your code and close the driver before exiting the code even where there is an exception something like:
try: # Do something with the driver here except Exception as e: # Handle the error print(f"An error occurred: {e}") finally: # Close the driver driver.quit()
TO close existing driver session you need to kill the PIDs from CLI
ps -ef | grep chromedriver
kill the PIDS or you can try pkill chromedriver
Thanks