I'm testing a smartgwt application by using selenium webdriver. This works pretty well for smartgwt widgets with something like this:
JavascriptExecutor executor = (JavascriptExecutor) context;
return (WebElement) executor.executeScript("return AutoTest.getElement(arguments[0]);", location);
In the above case, location is then something like //IButton[id=isc_button]/
However, we also have a few "basic" html elements on our pages that are no smartgwt widgets, but they do have an id. Hence my attempt to do those as follows (as the above doesn't work for these elements):
JavascriptExecutor executor = (JavascriptExecutor) context;
executor.executeScript("return document.getElementById(arguments[0]);", location);
This doesn't work though. Even with firebug, I tried document.getElementById('xxx')
for an element that I know exists with the given ID (as I can find it with the inspector on firebug's html tab) but that didn't work either.
Does anybody know why, and how is it then possible to reach a simple html element through javascript within the generated DOM tree?
Thanks!