selenium
selenium copied to clipboard
isDisplayed doesn't take into account collapsed/expanded details tag
🐛 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>
-
Open the page and verify that only the text "Click me!" is visible.
-
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
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.
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.
removed the stale tag
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.
@AutomatedTester how hard to add this to the atom? Is it an obvious fix, or something we need to really dig into?
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.
This issue was closed because it has been stalled for 14 days with no activity.
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.