Skip to content
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

Clicking Invisible option elements should not succeed (from google code #8563) #379

Closed
lukeis opened this issue Mar 27, 2015 · 2 comments
Closed

Comments

@lukeis
Copy link
Member

lukeis commented Mar 27, 2015

example html:

<select>
<option value="option0">option0</option>
<option value="option1" disabled="disabled">Disabled option</option>
<option value="option2" style="visibility: hidden;">Option hidden</option>
<option value="option3" style="display: none;">Option display none</option>
</select>

options = driver.find_elements_by_tag_name("option")

options[0].click(); <- behaves as expected
options[1].click(); <- does a no-op (expected behavior IMO)
options[2].click(); chrome renders this option, firefox doesn't. Firefox doesn't allow the user to select this, but WebDriver will select this option with this call.
options[3].click(); <- no one renders this option and it isn't settable by a user... yet webdriver sets it (and thus updates the rendered UI)

Related W3C WebDriver spec bug - https://www.w3.org/Bugs/Public/show_bug.cgi?id=28143

@opensource21
Copy link

You can see a possible solution for the disable-problem at elisarver/selophane@3d191b3.
I think it's not relevant if the click is possible or not, because you can obviously click on every element on a screen, perhaps to check if nothing happens. On the other side if I choose select(option1) I expected that after that option1 is selected or I get an exception or at least a return value which shows me that nothing could be selected.

opensource21 referenced this issue in elisarver/selophane Mar 28, 2015
clear.
Copied a lot of code from the original implementation.
Created an issue at selenium
https://code.google.com/p/selenium/issues/detail?id=8563
barancev added a commit that referenced this issue Nov 27, 2017
…inspired by #379. The tests are based on the current drivers' behavior, not sure if it is correct or not.
@barancev
Copy link
Member

Current behavior matches W3C WebDriver standard [1] that describes a special case of click operation for 'option' elements. Selenium does not actually click it, it selects an option. So it allows to select an option if it is selectable but not clilckable. For example, Firefox allows to pick an option with style="display: none;" if you put focus to its 'select' parent and govern it with the keyboard.

But Firefox driver allows to select a disabled element, and it seems to be an issue, I've moved it to geckodriver tracker [2]

[1] https://w3c.github.io/webdriver/webdriver-spec.html#element-click
[2] mozilla/geckodriver#1107

@lock lock bot locked and limited conversation to collaborators Aug 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants