Skip to content

[BUG] Click flakes without waitFor #1906

Closed

Description

Context:

  • Playwright Version: 0.13.0-next.1587493784299 (latest next version)
  • Operating System: Mac

Code Snippet

Code from this Twilio blog post. Since the click auto-waits for selectors, I removed the waitFor(duration) API calls from the code snippet.

const playwright = require('playwright');

const run = async () => {
  const browser = await playwright.webkit.launch();
  const page = await browser.newPage();

  const MODAL_BUTTON_SELECTOR = '.modal-footer > button';
  const SEARCH_SELECTOR = 'input[placeholder=Search]';
  const LOCATION_SELECTOR = 'li.active > a';
  const RESULTS_SELECTOR = '.results-tab';

  await page.goto('https://native-land.ca/');
  // await page.waitFor(200);
  await page.click(MODAL_BUTTON_SELECTOR);
  // await page.waitFor(300);

  await page.click(SEARCH_SELECTOR);
  await page.keyboard.type('Philadelphia');
  await page.waitForSelector(LOCATION_SELECTOR);

  await page.click(LOCATION_SELECTOR);
  await page.waitForSelector(`${RESULTS_SELECTOR} > p`);

  const results = await page.$(RESULTS_SELECTOR);
  const text = await results.evaluate(element => element.innerText);
  console.log(text);

  await page.screenshot({path: 'example.png'});

  await browser.close();
};

Describe the bug

On chrome and webkit, I'm seeing flakes around 50% of the time. Firefox seems to be failing more consistently.

TimeoutError: waiting for element to receive pointer events failed: timeout exceeded
    at Function.waitWithDeadline (/Users/arjun/pw-examples/node_modules/playwright-core/lib/helper.js:135:30)
    at ElementHandle._waitForHitTargetAt (/Users/arjun/pw-examples/node_modules/playwright-core/lib/dom.js:372:54)
    at async ElementHandle._performPointerAction (/Users/arjun/pw-examples/node_modules/playwright-core/lib/dom.js:193:13)
    at async Frame._retryWithSelectorIfNotConnected (/Users/arjun/pw-examples/node_modules/playwright-core/lib/frames.js:569:28)
    at async Frame.click (/Users/arjun/pw-examples/node_modules/playwright-core/lib/frames.js:584:9)
    at async run (/Users/arjun/pw-examples/twilio.js:15:3)
    at async /Users/arjun/pw-examples/twilio.js:39:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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