selenium icon indicating copy to clipboard operation
selenium copied to clipboard

isDisplayed doesn't take into account collapsed/expanded details tag

Open quiram opened this issue 4 years ago • 5 comments

🐛 Bug Report

A <details> tag will typically hide the elements within it (except for the content of <summary>) until the user clicks on it; however, elements within the <details> tag will be reported as visible by isDisplayed() no matter what.

I have checked this issue with Firefox, Chrome, and HtmlUnitDriver, which makes me think that the problem is probably browser-independent (this is why I'm reporting here). Apologies if my conclusion is wrong.

To Reproduce

Consider the following HTML snippet:

<details>
    <summary>Click me!</summary>
    <p>This element will be hidden or not...</p>
</details>
  1. Open the page and verify that only the text "Click me!" is visible.

  2. After obtaining a suitable webDriver, try this:

final WebElement text = webDriver.findElement(By.tagName("p"));
assertFalse(text.isDisplayed());

Expected behavior

Expected result: the assertion should work, because isDisplayed() should return false Actual result: the assertion fails, because isDisplayed() reports the text as visible.

Test script or set of commands reproducing this issue

I guess the issue is simple enough for it to be self-contained; happy to create additional resources if my assumption is wrong.

Environment

OS: macOS 10.15.5 (19F101) Browser: Chrome / Firefox / HtmlUnitDriver Browser version: 83.0.4103.116 / 77.0.1 / 2.40.0 Browser Driver version: 3.141.59 / 3.141.59 / 2.40.0 Language Bindings version:Java 13.0.2+8 Selenium Grid version (if applicable): N/A

quiram avatar Jun 25 '20 17:06 quiram

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Oct 18 '21 21:10 github-actions[bot]

I noticed this issue has been marked as stale. For what is worth, I just retested it and can confirm that the issue is still present.

quiram avatar Oct 21 '21 08:10 quiram

removed the stale tag

AutomatedTester avatar Oct 21 '21 08:10 AutomatedTester

This issue is stale because it has been open 280 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Jul 28 '22 10:07 github-actions[bot]

@AutomatedTester how hard to add this to the atom? Is it an obvious fix, or something we need to really dig into?

titusfortner avatar Jul 28 '22 23:07 titusfortner

This issue is stale because it has been open 280 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar May 05 '23 10:05 github-actions[bot]

This issue was closed because it has been stalled for 14 days with no activity.

github-actions[bot] avatar May 19 '23 20:05 github-actions[bot]

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Dec 09 '23 00:12 github-actions[bot]