SeleniumNewbe
SeleniumNewbe

Reputation: 85

How to handle array in Selenium IDE

I want to export e-mails from a web-page to Selenium for a later test. To check, if these e-mails are equal to later ones, shown in a selection.

I found a way to read them inside a while-loop. That's why I have to handle with arrays in IDE and I have no idea how to do that.

I tried it like this, but it doesn't work:

store | 0 |i
store | 17 | line
storeElementPresent | //html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbod/tr[${line}]/td[3]/a |adresseDa
while | ${adresseDa}!='0' 
storeEval | javascript{new Array()} | array
storeText | //html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbody/tr[${line}]/td[3]/a | mail
storeEval | storedVars.array[storedVars.i]=storedVars.mail 
echo | ${array}
storeEval | storedVars.line++
storeEval | storedVars.i++
storeElementPresent | //html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbod/tr[${line}]/td[3]/a | adresseDa
endWhile

The echo | ${array} retruns null. So apparently it doesn't works this way.

How can I store the e-mails in an array and how can I later get access to them?

Thanks!

Upvotes: 1

Views: 4540

Answers (1)

SeleniumNewbe
SeleniumNewbe

Reputation: 85

I found a solution :) To store the mails in a array:

store   | 17    | line
storeElementPresent  |//html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbod /tr[${line}]/td[3]/a | adresseDa
while | ${adresseDa}!='0'   
storeText | //html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbody/tr[${line}]/td[3]/a  | tempMail
store   | javascript{storedVars['tempMail'].substring(7,100)} | mail
push    | ${mail}  | mailArray
echo    | ${mailArray} 
storeEval | storedVars.line++       
storeElementPresent | //html/body/div/div[4]/*/div[3]/table/tbody/tr/td/table/tbody/tr[${line}]/td[3]/a | adresseDa
endWhile 

To check if the emails in the array are the same than in a DropDownMenu on a later webpage:

verifySelectOptions |   //*[@id="mainForm:Emailadresses"] | ${mailArray}

for the push an while you can download a extention from here:

http://51elliot.blogspot.de/2012/07/sideflow-update-selenium-ide-flow.html

Upvotes: 1

Related Questions