Sample codes below.
1. save as sample.html
<html>
<script>
function populateHiddenHolder() {
var hidden = document.getElementById("hidden");
hidden.innerHTML = "content from the hidden div";
}
</script>
<body onload="populateHiddenHolder()">
<div id="visible">content from the visible div!</div>
<div id="hidden" style="display:none"></div>
</body>
</html>
2. Run this WebDriver test.
@Test
public void test() {
HtmlUnitDriver driver = new HtmlUnitDriver();
driver.setJavascriptEnabled(true);
driver.get("file:///home/foconer/personal/sample.html");
WebElement visible = driver.findElement(By.id("visible"));
System.out.println("visible:: " + visible.getText());
RenderedWebElement hidden =
RenderedWebElement)driver.findElement(By.id("hidden"));
System.out.println("hidden:: " + hidden.getText());
}
3. Result (failed! hidden content is not displaying)
visible:: content from the visible div!
hidden::
Note: this works fine if style="display:none" is removed from the
hidden DIV.
it's a WebDriver "feature": the FirefoxDriver does exactly the same.
cheers,
Marc.
--
Blog: http://mguillem.wordpress.com
> --
> You received this message because you are subscribed to the Google Groups
> "webdriver" group.
> To post to this group, send email to webd...@googlegroups.com.
> To unsubscribe from this group, send email to
> webdriver+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/webdriver?hl=en.
>
>
Simon