9/19/2012

Running JavaScript with Selenium RC

If you want to run longer javascript code with the selenium java api, you’ll need to use the selenium.getEval(String jsCode); method. Also you have to consider, that only the last line of the javascript code is returned. For Example, if you have a TextModifier Object in your page which has the Method inverseString(StringToInverse) , a HTML-Element with known id, which name is “dlroW” and you’ll run the following command: The result will be Hello World. For not executing javascript and only injecting javascript into the page use the runScript(String jsCode) method of selenium.

No comments:

Post a Comment