Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upcannot deselect an option in a multi select with click() #1899
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukeis
Mar 2, 2016
Member
Sorry, the issue is that toggle() is deprecated, not setSelected()
Reported by luke.daley@gradle.biz on 2011-06-22 07:39:21
Reported by |
lukeis
self-assigned this
Mar 2, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukeis
Mar 2, 2016
Member
With FirefoxDriver, clicking a selected option indeed deselects this option. However,
I don't think that tweaking the HtmlUnitDriver to behave the same way is the ultimate
solution, as in a real browser, clicking a selected option does *not* deselect this
option, but all other selected options.
To be consistent with real browsers, we would actually need to perform some sort of
ctrl+click every time we want to deselect (or toggle) an option. Maybe, we can get
toggle() back?
Reported by jw_google@gmx.de on 2011-06-29 16:20:49
Reported by |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukeis
Mar 2, 2016
Member
Behavior is different across browsers. ChromeDriver clicking does not deselect the item
clicked, but FireFoxDriver does. Essentially, ChromeDriver is sending a click, and
FireFoxDriver is sending a CTRL+Click.
This is significant because Ctrl+Click (as far as I know) isn't supported, so ultimately
Chrome can't perform certain functions (for example, deselecting everything in a multiselect
box)
Reported by kevin.t.dillon on 2011-08-08 16:33:04
Reported by |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukeis
Mar 2, 2016
Member
This continues to happen with Selenium 2.3.1
To save debuggers some time, here is a simple test fails on Chrome but passes on Firefox
with Sel 2.3.1 (FF5, ChromeStable 13.0, chromedriver v14)
WebElement el = browserDriver.findElement(By.id("multiselect_id"));
Select sel = new Select(el);
sel.deselectByIndex(1);
assertEquals(1, sel.getAllSelectedOptions().size());
sel.deselectByIndex(2);
assertEquals(0, sel.getAllSelectedOptions().size());
Test page
<!DOCTYPE html>
<body>
<select id="multiselect_id" name="someMultiSelect" multiple="multiple">
<option id="opt0" value="opt0">Option 0</option>
<option id="opt1" value="opt1" selected="selected">Option 1</option>
<option id="opt2" value="opt2" selected="selected">Option 2</option>
</select>
</body>
Reported by binod80 on 2011-08-08 19:42:17
Reported by |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukeis
Mar 2, 2016
Member
Now already selected options can be deselected via click() also with HtmlUnitDriver.
However, support for that is built into HtmlUnitWebElement#click(), so it still won't
work if the advanced interactions API is used to click the option. Maybe the fix should
be moved to HtmlUnitMouse.
Reported by jw_google@gmx.de on 2011-08-31 14:21:16
Reported by |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukeis
Mar 2, 2016
Member
Reported by barancev on 2011-10-13 05:14:30
- Labels added: Component-WebDriver, Browser-HtmlUnit
|
Reported by
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukeis
Mar 2, 2016
Member
Is this issue still actual? I see all regression tests related to multiselect lists
are green for HtmlUnitDriver.
Reported by barancev on 2013-10-08 20:58:14
- Status changed:
NeedsClarification
Reported by
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukeis
Mar 2, 2016
Member
Just tried with Selenium/Java 2.37.0 and HtmlUnitDriver, FirefoxDriver, and ChromeDriver.
When clicking one of multiple selected options in a multi-select, the option element
gets deselected for HtmlUnitDriver, FirefoxDriver, and ChromeDriver. When doing the
same via the Interactions API, the option element is deselected for HtmlUnitDriver
only. So we still have an inconsistency between drivers.
Furthermore, we have an inconsistency between drivers and real browsers. When clicking
one of multiple selected options in a real browser, the targeted option remains selected,
while all other options get deselected.
Reported by jw_google@gmx.de on 2013-10-23 12:49:39
Reported by |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lukeis
Mar 2, 2016
Member
Reported by luke.semerau on 2015-09-17 17:44:24
- Labels added: Restrict-AddIssueComment-Commit
|
Reported by
|
lukeis commentedMar 2, 2016
Originally reported on Google Code with ID 1899
Reported by
luke.daley@gradle.bizon 2011-06-22 07:38:26