protractor icon indicating copy to clipboard operation
protractor copied to clipboard

WebDriverError: unknown error: cannot determine loading status from unknown error: unhandled inspector error: {"code":-32000,"message":"Inspected target navigated or closed"}

Open allbigbopper opened this issue 5 years ago • 19 comments

Hi! We started experiencing this problem on latest chrome browser versions

WebDriverError: unknown error: cannot determine loading status
from unknown error: unhandled inspector error: {"code":-32000,"message":"Inspected target navigated or closed"}
  (Session info: chrome=78.0.3904.87)
    at Object.throwDecodedError (/Users/allamudruk/Projects/support-site-frontend/node_modules/selenium-webdriver/lib/error.js:550:15)
    at parseHttpResponse (/Users/allamudruk/Projects/support-site-frontend/node_modules/selenium-webdriver/lib/http.js:542:13)
    at Executor.execute (/Users/allamudruk/Projects/support-site-frontend/node_modules/selenium-webdriver/lib/http.js:468:26)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  • Node Version: 10.13.0
  • Protractor Version: 6.0.0
  • Angular Version: ``
  • Browser(s): chrome=78.0.3904.87
  • Operating System and Version macOS Mojave 10.14.6
module.exports = {
  capabilities: {
    browserName: 'chrome',
    build: 'cucumber-js-browserstack',
  },
  framework: 'custom',
  frameworkPath: require.resolve('protractor-cucumber-framework'),
  specs: ['../tests/features/*.feature'],
  cucumberOpts: {
    require: ['../tests/step_definitions/*.js', '../tests/features/support/*.js'],
    tags: false,
    profile: false,
    'no-source': true,
    format: ['json:tests/report/cucumber-report.json', 'rerun:protractor_output/rerun.txt'],
  },
  theme: 'bootstrap',
  jsonFile: path.resolve('tests/report/cucumber-report.json'),
  output: path.resolve('tests/report/cucumber-report.html'),
  reportSuiteAsScenarios: true,
  launchReport: true,
};

onPrepare: async () => {
    await browser.waitForAngularEnabled(false);
  },
Before({timeout: TIMEOUT}, async () => {
  await browser.driver.get(`${browser.logoutUrl}/logout?continue=${browser.baseUrl}`);
  await browser.wait(protractor.ExpectedConditions.urlContains(`${browser.baseUrl}/`), 20000);
  await browser.driver.get(browser.baseUrl);
  await browser.driver.manage().addCookie({
    name: 'abcdef',
    value: 'true',
    domain: '.com',
  });
});

It almost always fails on first page load or login step

await formPage.goto()
await loginPage.addUsername(freeUsername);
await loginPage.addUserPassword(password);
return await loginPage.clickLoginButton();
async goto() {
    return await browser.get(this.url, this.timeout.xl);
  }

async addUsername(username) {
    await this.waitForElementAvailable(this.usernameField, this.timeout.l);
    await this.usernameField.clear();
    return await this.usernameField.sendKeys(username);
  }

  async addUserPassword(password) {
    await this.waitForElementAvailable(this.passwordField, this.timeout.l);
    await this.passwordField.clear();
    return await this.passwordField.sendKeys(password);
  }

  async clickLoginButton() {
    await this.waitForElementAvailable(this.loginButton, this.timeout.l);
    return await this.loginButton.click();
  }

async clickElement(locator) {
    await browser.executeScript('document.activeElement.blur();');
    return await locator.click().then(
      async promise => {
        return promise;
      },
      async err => {
      console.log('Element is not clickable at point. Other element would receive the click');
      }
    );
  }

allbigbopper avatar Nov 04 '19 11:11 allbigbopper

Have you had any update regarding this, as we are experiencing the same problem intermittently, having updated to the latest Chrome Browser version (78.0.3904.97).

Dan0803 avatar Nov 14 '19 09:11 Dan0803

I am having the IDENTICAL issue and am unable to resolve.

jweaver66 avatar Nov 14 '19 21:11 jweaver66

Was anyone able to resolve the issue, I have been facing it since 4 days

preethiraoatprospa avatar Nov 26 '19 00:11 preethiraoatprospa

I had this issue sometimes 3 weeks ago, but now not any more. I remember that an Iframe seems to have been the reason, which I had to look in and did not succeed, because it was in a way not there yet, the loading has slowed down. Because waiting for the iframe to get visible, caused also an error (this or a different; i do not remember) I let my browser sleep for a second, and then wait in a loop for visibility of the iframe and then go on.

Octopus134 avatar Nov 26 '19 08:11 Octopus134

I am getting this error only when I execute my test cases using Jenkins. One more strange things is, error is not consistent. It fails test cases randomly.

Let me know if you found a solution already.

kosh01 avatar Nov 28 '19 15:11 kosh01

Would be fixed in chromedriver 80. https://bugs.chromium.org/p/chromedriver/issues/detail?id=3164&q=&colspec=ID%20Status%20Pri%20Owner%20Summary Use 76 it should resolve this problem

NikitaV1 avatar Dec 02 '19 13:12 NikitaV1

Facing this same issue on v79. Any update?

MummanaSubramanya avatar Dec 21 '19 11:12 MummanaSubramanya

I'm also facing same issue. Any help ?

junaid18404 avatar Mar 09 '20 06:03 junaid18404

I'm also facing this issue with v79, however sometimes it works. Not sure what the cause for this is

Treborium avatar Mar 17 '20 15:03 Treborium

Having this issue in v80 - it happens about 25% of the time when I navigate to a page that does a redirect. Anyone have a workaround? Catching the error and retrying doesn't work.

heathkit avatar Apr 06 '20 17:04 heathkit

@heathkit

This is fixed in v81.

Issue 3252: Getting org.openqa.selenium.WebDriverException: unknown error: cannot determine loading status

https://bugs.chromium.org/p/chromedriver/issues/detail?id=3252&sort=-id&colspec=ID%20Status%20Pri%20Owner%20Summary&q=unhandled%20inspector%20error&can=1

Chrome v81 will be stable on April 7th. To overcome this issue, i built a custom chrome driver.

https://www.chromestatus.com/features/schedule

vsravuri avatar Apr 06 '20 18:04 vsravuri

I am still having this issue using chrome version 81. This is the error i get when running my automated tests:

- Failed: unknown error: cannot determine loading status from target frame detached (Session info: chrome=81.0.4044.92)

However, there have been some occasions where this does not occur and I am able to interact with the iframe (i.e. sendKeys to element) but most of the time it throws the above error. I can't seem to find anything out there to resolve this issue. HELP NEEDED please! Even if someone could just explain the issue to me from what they know about it. Thanks

cytora-tarren avatar Apr 08 '20 18:04 cytora-tarren

https://bugs.chromium.org/p/chromedriver/issues/detail?id=3361&can=2&q=&sort=-id&colspec=ID%20Status%20Pri%20Owner%20Summary

This is how i am able to workaround this issue while switching frame.

this.fn_SwitchToMainFrame = async () => { let success = false; let count = 0, max_tries = 40; while (!success && count++ < max_tries) { try { await browser.driver.switchTo().defaultContent(); await browser.driver.switchTo().frame(await browser.driver.findElement(by.xpath("//frame[@name="mainframe"]"))); success = true; } catch (e) { console.log('fn_SwitchToMainFrame ' + e); } if (success) { await browser.driver.sleep(500); break; } } if (!success) { console.log('Wasn't't successful after 40 retries'); } };

vsravuri avatar Apr 08 '20 20:04 vsravuri

When I am on a page I run the below to switch focus to the iframe:

browser.switchTo().frame(1);
//browser actions here

After clicking a button on the first iframe, it opens another iframe attached to the DOM, so now to interact with this new iframe I run: (note - that the first iframe is still open behind this new iframe)

browser.switchTo().defaultContent();
browser.switchTo().frame(2);

At this point everything works perfectly fine, so on the second iframe, I log into an account, one successful log in, the iframe is automatically closed and I can see the first iframe again. At this point I run the below code to interact with the first iframe again:

browser.switchTo().defaultContent();
browser.switchTo().frame(1);
browser.sleep(4000);
element(by.css("input[placeholder='Type an address and press enter...'")).sendKeys('fake address');

This is when i receive the error message below: - Failed: unknown error: cannot determine loading status from target frame detached (Session info: chrome=81.0.4044.92)

cytora-tarren avatar Apr 09 '20 14:04 cytora-tarren

Hi all, I'm expecting the same issue after upgrading the Chrome browser and webdriver to the latest version. Now a lot of automation tests are failing... For me, it occurs when I'm working with frames and performing any actions there: trying to fill some textbox or click a button. Please assist!

dextrous2010 avatar Apr 27 '20 15:04 dextrous2010

Do we have any update about the issue, I'm getting the same error with the chrome 81.0.4044.122 image

yopasa94 avatar May 04 '20 19:05 yopasa94

any update on this? I am facing the same issue

guicsou-lw avatar Aug 17 '20 17:08 guicsou-lw

chrome_options.add_argument('--disable-site-isolation-trials')

Bgirish0 avatar Sep 03 '20 19:09 Bgirish0

Did that add_argument resolve the issue for you @Bgirish0 ?

n2nco avatar Sep 04 '20 09:09 n2nco