Showing posts with label data driven testing selenium using javascript array. Show all posts
Showing posts with label data driven testing selenium using javascript array. Show all posts

Thursday, March 12, 2009

Selenium Script for autologin

="">
WhileAutoLogin
store 4 iterations
store 0 x
while storedVars.x<storedVars.iterations
store javascript{selenium.browserbot.baseUrl} URL
open javascript{storedVars.URL}
getEval //alert('{x}: '+${x});alert('storedVars: '+storedVars['x'])
storeEval function(x) {var users=new Array("kent","popup","anilk","String4","",""); return users[x];} getUser
storeEval function(x) {var pass=new Array("industries","123456","123456","123456");return pass[x];} getPass
type //input[contains(@name,'User') or contains(@id,'user') or contains(@id,'UserName') or contains(@id,'log') or contains(@name,'login') or contains(@name,'Log')] javascript{storedVars.getUser(storedVars.x)}
type //input[contains(@type,'password') or contains(@id,'pass') or contains(@name,'pass')] javascript{storedVars.getPass(storedVars.x)}
clickAndWait //input[contains(@type,'submit') or contains(@id,'ogin')]
waitForPageToLoad 3000
getEval storedVars.textPresent=""
storeTextPresent Incorrect Username textPresent
getEval //alert(storedVars.textPresent)
gotoIf storedVars.textPresent skipRecord
waitForPageToLoad 3000
captureEntirePageScreenshot C:\${x}logo.png
label skipRecord
getEval storedVars.x=eval(storedVars.x)+1;
endWhile
getEval alert('Testing finished '+storedVars.x+' iterations')