Search code examples
javaseleniumautomationselenium-chromedrivercucumber

Getting "org.openqa.selenium.WebDriverException: unknown error: session deleted because of page crash" error when executing automation scripts


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

    }

Solution

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