selenium call javascript function

1.call the dom element:

java script or snippet we call it in selenium, we can write using the dom concept or css concept .

Example: Selenium RC code
Selenium sel
sel.getEval("dom=window.document.getElementsByName('password')[0].value=test123"); //enter the password

String pwd =sel.getEval("dom=window.document.getElementsByName('password')[0].value");// retrieve the value from the application.

2.call the javascript function:

selenium.getEval("selenium.browserbot.getCurrentWindow().yourFun(1)");

note: yourFun(str) is the javacript function in html.

你可能感兴趣的:(JavaScript,function,selenium)