angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

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

Open allbigbopper opened 5 years ago

allbigbopper commented 5 years ago

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)
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');
      }
    );
  }
Dan0803 commented 5 years ago

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).

jweaver66 commented 5 years ago

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

preethiraoatprospa commented 5 years ago

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

Octopus134 commented 5 years ago

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.

kosh01 commented 5 years ago

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.

NikitaV1 commented 4 years ago

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

MummanaSubramanya commented 4 years ago

Facing this same issue on v79. Any update?

junaid18404 commented 4 years ago

I'm also facing same issue. Any help ?

Treborium commented 4 years ago

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

heathkit commented 4 years ago

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.

vsravuri commented 4 years ago

@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

cytora-tarren commented 4 years ago

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

vsravuri commented 4 years ago

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'); } };

cytora-tarren commented 4 years ago

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)

dextrous2010 commented 4 years ago

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!

yopasa94 commented 4 years ago

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

guicsou-lw commented 4 years ago

any update on this? I am facing the same issue

Bgirish0 commented 4 years ago

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

n2nco commented 4 years ago

Did that add_argument resolve the issue for you @Bgirish0 ?