question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] `page.locator.isVisible` returns `true` on hidden element

See original GitHub issue

Context:

System:

  • OS: Windows 10 10.0.19044
  • Memory: 926.38 MB / 15.78 GB

Binaries:

  • Node: 18.0.0 - C:\Program Files\nodejs\node.EXE
  • npm: 8.7.0 - C:\Program Files\nodejs\npm.CMD

Languages:

  • Bash: 5.0.17 - C:\WINDOWS\system32\bash.EXE

npmPackages:

  • playwright: ^1.23.0 => 1.23.0

Code Snippet

test('test', async ({ page }) => {
    await page.goto('C:\\page.html')
    const selector = '.sapUiLocalBusyIndicatorAnimStandard'
    const isVisible = await page.locator(selector).isVisible()
    console.log(isVisible) // true
    await page.waitForSelector(selector, {state: 'hidden'}) // success
  })

Describe the bug this SAPUI5 busy indicator is not visible, and page.waitForSelector(selector, {state: 'hidden'}) succeeds, however page.locator.isVisible incorrectly returns true. the bounding box seems to also be empty:

image image

unfortunately i’m not able to share the full html as it’s for an internal site, though i’m open to suggestions to try and provide a minimal example.

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:3
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
pavelfeldmancommented, Jul 27, 2022

Thanks for the report! isVisible was not working correctly for elements that are inside <button> (role=button in your case).

0reactions
DetachHeadcommented, Jul 26, 2022

@pavelfeldman

ok i was able to reproduce it with the example elements on the sapui5 docs

test('test', async ({ page }) => {
    await page.goto('https://sapui5.hana.ondemand.com/1.98.0/#/entity/sap.m.PullToRefresh/sample/sap.m.sample.PullToRefresh')
    await page.click('"Reject All"')
    await page.waitForSelector("span:text-is('Refresh')")
    const selector = '.sapUiLocalBusyIndicatorAnimStandard'
    const isVisible = await page.locator(selector).isVisible()
    await page.waitForSelector(selector, {state: 'hidden'})
    console.log('selector was hidden, but isVisible was', isVisible) // selector was hidden, but isVisible was true
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Check if element is visible in Playwright - Stack Overflow
2 for testing and facing a problem with elements' visibility. I want to check if a modal is visible on screen so I...
Read more >
Intent to Prototype: Element.isVisible method - Google Groups
isVisible() returns true if the element is visible, and false if it is not. It checks a variety of factors that would make...
Read more >
Locator | Playwright - CukeTest
Locator represents a view to the element(s) on the page. It captures the logic sufficient to retrieve the element at any given moment....
Read more >
Playwright.Locator — playwright v1.18.0-alpha.1 - HexDocs
Locator represents a view to the element(s) on the page. ... Returns whether the element is visible. ... ElementHandle.t() | {:error, Playwright.Channel.
Read more >
Element.isVisible method - Chrome Platform Status
Element.isVisible() returns true if the element is visible, and false if it is not. It checks a variety of factors that would make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found