Skip to content

[BUG] A page.click() that initiates a navigation requires a waitFor() before a page.goto() #1987

@thernstig

Description

@thernstig

Context:

  • Playwright Version: 0.15.0
  • Operating System: Ubuntu 18.04.4

Code Snippet

const {chromium, webkit, firefox} = require('playwright');

(async () => {
  const browser = await chromium.launch();
  const context = await browser.newContext();
  const page = await context.newPage();
  await page.goto('http://0.0.0.0/login.html');
  await page.fill('input[type=text]', 'admin');
  await page.fill('#password', 'admin');
  await page.click('#button');
  await page.waitFor('my-cool-app-container', {
    waitFor: 'visible', // This one is required for some reason
  });
  await page.goto('http://0.0.0.0/#my-second-cool-app}');
})();

Describe the bug

When initiating a navigation via await page.click('#button') I need the intermediate page.waitFor() to wait for an element to appear, before doing the next await page.goto('http://0.0.0.0/#my-second-cool-app}'). I am not sure why or if it is needed, but my reasoning is that it should not be and that there is some kind of bug happening here. I can mention it is intermittent and most often it works properly.

The printout that can happen is this Navigation interrupted by another one while navigating to http://0.0.0.0/#my-second-cool-app.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions