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
Hi all,
With 2.1.0, the far below HTML and WebDriver test case works differently with FF 5
/ IE 9 / HtmlUnit 2.8
Output:
IE:
getText() a,a, -> Correct (should it be "a,")
getAttribute() a,a, -> Correct (should it be "a,")
FF:
getText() -> Incorrect
getAttribute() a,a, -> Correct (should it be "a,")
HU:
getText() -> Incorrect (due to WebDriver)
getAttribute() -> Incorrect (due to HtmlUnit)
Please note that HtmlUnit 2.8 behaves correctly for getText(), but not with getAttribute()
which I will try to fix.
----------------------------------
<html><head><title>foo</title><script>
function init() {
var s = document.getElementById('s');
if (s.addEventListener) {
s.addEventListener('click', handle, false);
} else if (s.attachEvent) {
s.attachEvent('onclick', handle);
}
}
function handle(event) {
myTextArea.value += s.options[s.selectedIndex].value + ',';
}
</script></head><body onload='init()'>
<select id='s'>
<option value='a'>A</option>
<option id='opb' value='b'>B</option>
<option value='c'>C</option>
</select>
<textarea id=myTextArea></textarea>
</body></html>
----------------------------------
WebDriver:
WebDriver driver = ....;
driver.get(url);
driver.findElement(By.id("opb")).click();
WebElement e = driver.findElement(By.id("myTextArea"));
System.out.println("getText() " + e.getText());
System.out.println("getAttribute() " + e.getAttribute("value"));
Thread.sleep(3000);
driver.close();
----------------------------------
HtmlUnit:
WebClient webClient = ...;
HtmlPage page = webClient.getPage(url);
page.getHtmlElementById("opb").click();
HtmlTextArea e = page.getHtmlElementById("myTextArea");
System.out.println("getText() " + e.getText());
System.out.println("getAttribute() " + e.getAttribute("value"));
Reported by asashour@yahoo.com on 2011-07-26 10:25:03
Originally reported on Google Code with ID 2131
Reported by
asashour@yahoo.comon 2011-07-26 10:25:03