playwright icon indicating copy to clipboard operation
playwright copied to clipboard

[Bug]: Click on visible element fails due to timeout in visibility check

Open fabianboth opened this issue 8 months ago • 1 comments

Version

1.43.1

Steps to reproduce

  import { chromium } from "playwright-core";

  const browser = await chromium.launch();
  const tab = await browser.newPage();

  await tab.goto("https://www.nivus-rain.com/#nivus");
  await tab.getByTestId("uc-accept-all-button").click();
  await tab.waitForTimeout(3_000);

  const locator = tab.getByRole("link", { name: "Button_english_Desktop" });
  await locator.click({ timeout: 5_000 });

Expected behavior

The change language button should be clicked correctly, as this can also be clicked with the mouse.

Actual behavior

This test is clicking the change language button (e.g. changing to english, this might differ based on your current region). The button is clickable with the mouse, but the playwright click is not working.

Additional context

I assume the reason is that the parent has a size of 0x0 and also has the same locator as the actual language flag.

image

Environment

System:
    OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz
    Memory: 18.95 GB / 31.05 GB
    Container: Yes
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
    pnpm: 9.0.6 - ~/.nvm/versions/node/v20.9.0/bin/pnpm
  IDEs:
    VSCode: 1.90.1 - /snap/bin/code
  Languages:
    Bash: 5.1.16 - /usr/bin/bash
  # playwright managed by pnpm

fabianboth avatar Jun 17 '24 15:06 fabianboth