0

org.openqa.selenium.WebDriverException: unknown error: session deleted because of page crash from unknown error: cannot determine loading status from tab crashed (Session info: chrome=95.0.4638.54)

I am getting this errorsince chromedriver version 93 to 95, the driver crashes when specifically executing a specific step definition while sometimes it executes without a problem, this makes all the other subsequent tests to fail.

Tried couple of solutions like enabling the flag --disable-dev-shm-usage to chromedriver options arguments but it does not work

Am using selenium-java 4.0.0

Below is the cucumber step and consequent method in java

Then Click on registration application link

    @Then("^Click on registration application link$")
    public void click_on_registration_application_link() throws Throwable {
        Thread.sleep(3000);
        WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(60));
        WebElement caseManagement = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("TabCS")));
        caseManagement.click();
        Thread.sleep(1000);
        driver.findElement(By.id("tbg_registrationapplication")).click();

    }
Harry Coder
  • 2,429
  • 2
  • 28
  • 32
  • that long sleep is a little odd. I'm assuming there's a very slow back-end at play here. This might actually time-out Selenium's page load. (You can set that if you really need a >15 minute sleep before the server responds) You might need to use another .get() before your driver.findElement call. (Assuming page load has timed out, you need to refresh the DOM) – pcalkins Oct 25 '21 at 19:58
  • The backend is CRM so definitely its not the fastest. It did not have that long sleep, i just put it to see if it will make a difference – Maxwell Maragia Oct 26 '21 at 05:38
  • if Chrome is open when you get this error, the driver may be stuck in "no-mans land". This can happen when switching the driver to different tabs/windows/frames and they close. – pcalkins Oct 26 '21 at 17:34

2 Answers2

0

Following reasons for WebDriverException: unknown error:

  1. Version mismatch between chrome and chromedriver
  2. Multiple thread using same chrome driver
  3. Improper Static webdriver usage
  4. Chrome memory is become high due to large number of API call and data handling in the web application.
  5. while running automation, parallelly we were using chrome browser.
Jayanth Bala
  • 758
  • 1
  • 5
  • 11
0

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();

}