You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.
I am using selenium-htmlunit-driver-2.4.0 and I want to get all selected options in
a select.
The test fail and looking at the code it seems to be wrong:
In HtmlUnitWebElement:
public boolean isSelected() {
assertElementNotStale();
if (element instanceof HtmlInput) {
return ((HtmlInput) element).isChecked();
} else if (element instanceof HtmlOption) {
return ((HtmlOption) element).hasAttribute("selected");
}
[...]
}
return ((HtmlOption) element).hasAttribute("selected");
should be replaced by
return ((HtmlOption) element).isSelected();
Indeed when you have a select with no options having selected attribute, the first
option is selected by default.
Example:
<form id="form6">
<select name="select1">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</select>
</form>
Select.getAllSelectedOptions() should return option "one".
Reported by glaurung.aubrane on 2011-08-18 14:33:10
The text was updated successfully, but these errors were encountered:
Originally reported on Google Code with ID 2295
Reported by
glaurung.aubrane
on 2011-08-18 14:33:10The text was updated successfully, but these errors were encountered: