3

I received an error. When I did a google search, I got some results but they were all for Android programming. I am automating a test using Windows, Java 1.8 and Selenium.

The error

 org.openqa.selenium.WebDriverException: unknown error: cannot activate web view

My original code (that I did not write but am debugging and has worked):

    // Clicks a link which opens a new window
    action.moveToElement(el).click(el).build().perform();
    Set<String> windows = driver.getWindowHandles();
    for (String a: windows) {
        Reporter.log(a);
        driver.switchTo().window(a);
    }

The error I got was that there was "no such window". So I thought maybe I needed to wait until the number of windows stabilized, so I added the following after clicking and before doing the windows stuff:

    int winds = driver.getWindowHandles().size();
    int owinds = winds - 1;
    while (owinds != winds) {
        Thread.sleep(1000);
        owinds = winds;
        winds = driver.getWindowHandles().size();
    }

It is at this point, where it does the switch, that I get the

 org.openqa.selenium.WebDriverException: unknown error: cannot activate web view

and as I mentioned before, everything in Google only talks about Android, which this is not.

Any thoughts would be welcome.

Tony
  • 1,127
  • 1
  • 18
  • 29

1 Answers1

4

I had this problem in JavaScript using Webdriver.io. I'm answering since it had the same characteristics described here, specifically that I was opening a new tab and I'd get this error.

I first added more memory/resources to my docker container and then got an issue that was resolved by this answer: https://stackoverflow.com/a/52340526/491553.

Once I applied the following Chrome arguments, I didn't see this again:

  "--no-sandbox",
  "--disable-infobars", // https://stackoverflow.com/a/43840128/1689770
  "--disable-dev-shm-usage", // https://stackoverflow.com/a/50725918/1689770
  "--disable-browser-side-navigation", // https://stackoverflow.com/a/49123152/1689770
  "--disable-gpu", // https://stackoverflow.com/questions/51959986/how-to-solve-selenium-chromedriver-timed-out-receiving-message-from-renderer-exc
  "--disable-features=VizDisplayCompositor"  // https://stackoverflow.com/a/55371396/491553
Ryan Shillington
  • 23,006
  • 14
  • 93
  • 108