You can use the getEval(String script) command to evaluate javascript to fetch the property.
Selenium can be pretty limited in this sense
EDIT:
this.style.someAttribute will give you the value of someAttribute css style for the given Selenium node.
Also, if you want to run JavaScript on elements within the document body, such as document.getElementById .., you need to preceed your JavaScript string with "this.browserbot.getCurrentWindow()". For example, if I wanted to get the innerHTML of the element with id 'page_title', I would call
String title = getEval("this.browserbot.getCurrentWindow().document.getElementById('page_title').innerHTML");
This will evaluate the JavaScript in the context of the window you are testing. Failure to include this will execute JavaScript within the context of the Selenium frame. Seethis documentation on the Selenium API.
You can use the
getEval(String script)
command to evaluate javascript to fetch the property.Selenium can be pretty limited in this sense
EDIT:
this.style.someAttribute
will give you the value ofsomeAttribute
css style for the given Selenium node.Also, if you want to run JavaScript on elements within the document body, such as
document.getElementById
.., you need to preceed your JavaScript string with "this.browserbot.getCurrentWindow()". For example, if I wanted to get the innerHTML of the element with id 'page_title', I would callThis will evaluate the JavaScript in the context of the window you are testing. Failure to include this will execute JavaScript within the context of the Selenium frame. See this documentation on the Selenium API.