unknown error: session deleted because of page crash from unknown error: cannot determine loading status from tab crashed with ChromeDriver Selenium
Though you see the error as:
Error occurred while deleting cookies from web browser!
b'Message: invalid session id\n (Driver info: chromedriver=2.44.609551 (5d576e9a44fe4c5b6a07e568f1ebc753f1214634),platform=Linux 4.15.0-42-generic x86_64)\n'
The main exception is:
selenium.common.exceptions.WebDriverException: Message: unknown error: session deleted because of page crash
from unknown error: cannot determine loading status
from tab crashed
Your code trials would have given us some clues what going wrong.
Solution
There are diverse solution to this issue. However as per UnknownError: session deleted because of page crash from tab crashed this issue can be solved by either of the following solutions:
Add the following
chrome_options
:chrome_options.add_argument('--no-sandbox')
Chrome seem to crash in Docker containers on certain pages due to too small
/dev/shm
. So you may have to fix the small/dev/shm
size.An example:
sudo mount -t tmpfs -o rw,nosuid,nodev,noexec,relatime,size=512M tmpfs /dev/shm
It also works if you use
-v /dev/shm:/dev/shm
option to share host/dev/shm
Another way to make it work would be to add the
chrome_options
as--disable-dev-shm-usage
. This will force Chrome to use the/tmp
directory instead. This may slow down the execution though since disk will be used instead of memory.chrome_options.add_argument('--disable-dev-shm-usage')
from tab crashed
from tab crashed was WIP(Work In Progress) with the Chromium Team for quite some time now which relates to Linux attempting to always use /dev/shm for non-executable memory. Here are the references :
- Linux: Chrome/Chromium SIGBUS/Aw, Snap! on small /dev/shm
- Chrome crashes/fails to load when /dev/shm is too small, and location can't be overridden
- As per Comment61#Issue 736452 the fix seems to be have landed with Chrome v65.0.3299.6
Reference
You can find a couple of relevant discussions in:
- org.openqa.selenium.SessionNotCreatedException: session not created exception from tab crashed error when executing from Jenkins CI server
Python Selenium session deleted because of page crash from unknown error: cannot determine loading status from tab crashed
the solution was to remove elements from the dom tree
like what @pcalkins said above the dom tree seems to "overload" otherwise
Getting org.openqa.selenium.WebDriverException: unknown error: session deleted because of page crash error when executing automation scripts
For some reason the following code worked, could't figure out at all what the issue was
@Then("^Click on registration application link$")
public void click_on_registration_application_link() throws Throwable {
switch_to_frame0();
thirty.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//span[contains(text(),'Active Cases in Progress Overview')]"))).isDisplayed();
switchToDefault();
Thread.sleep(1000);
driver.findElement(By.xpath("//*[@id=\"TabCS\"]/a/span")).click();
Thread.sleep(1000);
driver.findElement(By.id("tbg_registrationapplication")).click();
}
selenium.WebDriverException: unknown error: session deleted because of page crash from tab crashed (Not on docker)
For everyone facing the same issue in the future. The problem isn't with the chrome driver, it is with the DOM getting too large that causes the V8 JS memory to break at a point and call the OOM.
To fix this for me, I thought of using the Facebook mobile version and it actually worked. Facebook mobile version of the website is much lighter and has much less complicated DOM which allows me to reach 5k+ posts actually.
I hope this helps everyone wondering the same. If you have a similar issue, try to find ways to simplify the DOM or have another simplified DOM Views, I found some extensions help with that as well.
unknown error: cannot determine loading status error using chrome=104.0.5112.81 with Cucumber and Selenium::WebDriver
This error message...
unknown error: cannot determine loading status
from unknown error: unexpected command response
(Session info: chrome=104.0.5112.81) (Selenium::WebDriver::Error::UnknownError)
Backtrace:
.
.
RtlGetAppContainerNamedObjectPath [0x77CC7A9E+286]
RtlGetAppContainerNamedObjectPath [0x77CC7A6E+238]
...implies that there is some mismatch between the chromedriver and the chrome versions.
Solution
As you are using chrome=104.0.5112.81
ensure that you have download chromedriver=104.0.5112.79
and using the same.
Related Topics
"Fire and Forget" Python Async/Await
Binary Search (Bisection) in Python
Saving a Numpy Array as an Image
Generate 'N' Unique Random Numbers Within a Range
Python Pandas - Find Difference Between Two Data Frames
How to Get a Directory Listing Sorted by Creation Date in Python
Scope of Lambda Functions and Their Parameters
Is There a Label/Goto in Python
What Is a Cross-Platform Way to Get the Home Directory
Convert a Number Range to Another Range, Maintaining Ratio
What Is the Intended Use of the Optional "Else" Clause of the "Try" Statement in Python
Apply VS Transform on a Group Object
Using Pip Behind a Proxy with Cntlm