Solve – ChromeDriver Selenium unknown error: session deleted because of page crash from unknown error: cannot determine loading status

ChromeDriver Selenium unknown error: session deleted because of page crash from unknown error: cannot determine loading status is an error that occurs when the browser crashes.

In this article I will try to show you guys how to solve this confusing error and also explain why the error is even occurring. I will also present other solutions that worked for other developers and may also work for you.

Describing unknown error: ChromeDriver Selenium unknown error: session deleted because of page crash from unknown error: cannot determine loading status

I am going to explain this error by trying to replicate this error and explore why it is occurring in the first place.

The error occurs a lot in InstaPy which uses Selenium and Python.

The script runs fine most of the time but sometimes it just crashes, I can replicate the error on both Linux and Windows and you can test it too.

This is the resulting error message, it is very long.

ChromeDriver Selenium unknown error session deleted because of page crash from unknown error cannot determine loading status-problem-banner

Bellow I present the solutions that worked for me and other solutions that worked for other developers, you should try them one by one until you find the solution that suits you.

Solution 1 : add chrome_options

I want to be clear by saying this is the solution that first worked for me. The solution is simple, you should add chrome_options as follows.

ChromeDriver Selenium unknown error session deleted because of page crash from unknown error cannot determine loading status-problem-banner-1

This is not the only solution, if this does not work for you, there are a lot of possible fixes that you can try.

Solution 2 : use –disable-dev-shm-usage.

If adding chrome_options does not work please try to add the chrome_options as --disable-dev-shm-usage.

As a result chrome will be forced to use the directory /tmp.

The code bellow is how you execute the solution.

ChromeDriver Selenium unknown error session deleted because of page crash from unknown error cannot determine loading status-problem-banner-2

If this solution worked for you, please consider donating to our Kofi account, you can do that by clicking on the red button on top of this page.

Solution 3 : use –shm-size=2g when creating the docker containers.

This solution will work for you if you have docker containers and you are facing the error above.

The error can be solved if you use the following flag –shm-size=2g when you are creating the docker containers.

This is how the code can look like, this is just an example, you should adapt the idea to your own code.

ChromeDriver Selenium unknown error session deleted because of page crash from unknown error cannot determine loading status-problem-banner-3

Solution 4 : use time.sleep

The last solution is simple, make sure you can identify where the error occurs in your code and try add a waiting time or sleeping time.

The goal is for the code to sleep for a bit in order to give the time to selenium to do its job, you can do that by adding the code bellow before the location of the error.

                                                                       #
# add this code before the location of the error
time.sleep(x)
                                                                       #

Make sure to replace x with the duration of your choice, I hope this works for you.

Summing-up

The article is over guys, I hope my effort did not go to waste and I helped some of you solve the error : ChromeDriver Selenium unknown error: session deleted because of page crash from unknown error: cannot determine loading status , keep learning Python and keep coding, cheers.

If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/