-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[🐛 Bug]: elementToBeClickable wait condition fails on elements with opacity 0 #15025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@ysiivan, thank you for creating this issue. We will troubleshoot it as soon as we can. Info for maintainersTriage this issue by using labels.
If information is missing, add a helpful comment and then
If the issue is a question, add the
If the issue is valid but there is no time to troubleshoot it, consider adding the
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable
After troubleshooting the issue, please add the Thank you! |
@ysiivan Before starting the discussion on this again, please provide a valid exampe page and some code to reproduce this. Without a concrete example it is hard to tell what is the correct way of dealing with things. |
Hi, @ysiivan. Either a complete code snippet and URL/HTML (if more than one file is needed, provide a GitHub repo and instructions to run the code), the specific versions used, or a more detailed description to help us understand the issue. Note: If you cannot share your code and URL/HTML, any complete code snippet and URL/HTML that reproduces the issue is good enough. Reply to this issue when all information is provided, thank you. |
@joerg1985 The app I encountered this with is not publicly accessible. I'll see if I can something else to demonstrate. |
@joerg1985 Attached is a static html file (zipped) that demonstrates the issues:
var element = wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(by)); Which fails for either of the two checkboxes on the page. The wait delegate uses
Both controls are visible on the page and can be clicked on manually. |
I had a look at the example and the problem here is the useage of The webdriver is not aware of these css-pseudo-elements, so you can not get a reference to them and interact with them directly. Changing the
So we have to workaround when handling these elements, one way to do so is to use the Actions API. The Action API will not scroll to the element or check anything, it will just performe the given commands. I am not a C# dev, but this should work in this case:
|
The problem of how to assess and wait for "clickability" still remains. |
This workaround does not work for lbl2. Still throwing |
You are missing a feature to access
I have tested with java and for me the snippet below does work. @nvborisenko Could you please check this with the dotnet binding? The
|
Hello @ysiivan Fix clickability check to ignore opacity when waiting for an elementThe current isDisplayed() method in Selenium does not handle cases where opacity is set to 0. If you want to disregard opacity when checking for clickability, you could expose an additional option or parameter, such as ignoreOpacity, to force the clickability check to ignore opacity values. You can propose a solution where Selenium provides an explicit mechanism to ignore opacity when waiting for an element to be clickable. If you're comfortable contributing code to Selenium, you can modify the method responsible for determining if an element is clickable. You might update or create a new method that does not consider opacity: 0 when evaluating whether the element is clickable. For example: You can add an optional parameter in the existing method that checks for visibility and clickability, which would allow the user to ignore opacity.
Expose this feature via WebDriverWait: You could extend or modify the WebDriverWait functionality to accept this new flag when waiting for an element to be clickable |
This issue was closed because we did not receive any additional information after 14 days. |
This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs. |
What happened?
The condition to evaluate the "clickability" of an element considers whether the element is
Displayed
, which does not regard elements with an opacity of 0 asDisplayed
.The proposal in the closed 14030 was to make
Displayed
disregard the opacity. I understand the arguments on both sides. However at the end of the day, the actual problem is still not resolved - waiting for "clickability", as it is now, is unreliable. The original post was about React, I just encounter the issue in an Angular app. Clickjacking or not, it seems the technique is apparently being used. I can't judge whether this is a right or a wrong way of doing things, but so should not Selenium.All this aside - the bottom line is - opacity does not play a role in "clickability".
If
Displayed
is to stay as it is, then how can we properly ascertain "clickability"?I'm not the best at reading minified javascripts, but it seems
is-displayed.js
"atom" is already wired to take an optional parameter for ignoring opacity. Perhaps expose a way to use that?How can we reproduce the issue?
Relevant log output
Operating System
N/A
Selenium version
N/A
What are the browser(s) and version(s) where you see this issue?
Chrome
What are the browser driver(s) and version(s) where you see this issue?
130.x.x.x
Are you using Selenium Grid?
No
The text was updated successfully, but these errors were encountered: