Skip to content

[BUG] click visibility check fails for visible element #5765

Closed

Description

Context:

  • Playwright Version: [what Playwright version do you use?] 1.9.1
  • Operating System: [e.g. Windows, Linux or Mac] Mac
  • Node.js version: [e.g. 10.12, 10.14] v12.16.3
  • Browser: [e.g. All, Chromium, Firefox, WebKit] Chromium
  • Extra: [any specific details about your environment]
  System:
    OS: macOS 10.15.7
    Memory: 765.40 MB / 16.00 GB
  Binaries:
    Node: 12.16.3 - ~/.nodenv/versions/12.16.3/bin/node
    npm: 6.13.4 - ~/.nodenv/versions/12.16.3/bin/npm
  Languages:
    Bash: 3.2.57 - /bin/bash
  npmPackages:
    playwright: 1.9.1 => 1.9.1

Code Snippet
This code snippet should reproduce the bug. It loads a Stackblitz project that I've created.

const { chromium } = require("playwright");

(async () => {
  const browser = await chromium.launch({
    headless: false
  });
  const context = await browser.newContext();

  // Open new page
  const page = await context.newPage();

  // ---------------------
  // Load & run project
  await page.goto("https://xntbhj.stackblitz.io/");
  await page.waitForSelector(`text="Run this project"`)
  await page.click(`button:has-text('Run this project')`);

  // Wait for the app to render
  await page.waitForSelector(`#go-to-sign-up`)
  await page.waitForTimeout(1000);
  
  await page.click(`#go-to-sign-up`) /// <<<<<<<< this click fails in chromium

  // ---------------------
  await context.close();
  await browser.close();
})();

Describe the bug

I'm trying to make Playwright click the "Sign up" link. Although the link is visible (and can be clicked if you visit the app), Playwright thinks that it's not. Each attempt fails with "element is not visible":

pw:api => page.click started +0ms
pw:api waiting for selector "#go-to-sign-up" +2ms
pw:api   selector resolved to visible <ws-a href="#signup" id="go-to-sign-up">…</ws-a> +3ms
pw:api attempting click action +3ms
pw:api   waiting for element to be visible, enabled and stable +0ms
pw:api   element is visible, enabled and stable +17ms
pw:api   scrolling into view if needed +0ms
pw:api   done scrolling +1ms
pw:api   element is not visible +1ms
pw:api retrying click action, attempt #1 +0ms
pw:api   waiting for element to be visible, enabled and stable +0ms
pw:api   element is visible, enabled and stable +31ms
pw:api   scrolling into view if needed +0ms
pw:api   done scrolling +1ms
pw:api   element is not visible +0ms
< retries until failure >

The app is built with LitElement, and something about its use of <slot> seems to trigger this bug. I tried using a few alternative selectors (a#go-to-sign-up, ws-a >> a, etc) but they fail in the same fashion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

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