Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

how to call single code multiple times?

View previous topic View next topic Go down

how to call single code multiple times?

Post by anbarasi on Fri Apr 12, 2013 11:19 am

hi can anybody tell how to proceed following ....

my application is have to click a drop down which has nearly 150 options and select each of them and add to the database... instead of repeating the same steps 150 times i need to do in a single step with those 150 values calling ...

anbarasi
Amateur
Amateur

Posts : 40
Join date : 2012-04-30
Age : 28
Location : chennai

Back to top Go down

Re: how to call single code multiple times?

Post by ccox on Fri Apr 12, 2013 10:38 pm

store | 0 | i
while | ${i}<150 |
select | drop down name| index = ${i}
//And whatever other steps you need to add to the DB
store | javascript {storedVars.i++}
endWhile

if the first option in your drop down is not a valid option(typically it is something like "Select an Option") then set 'i' to 1 instead of 0 and change your while condition to ${i}<=150

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 31
Location : Denver, CO

Back to top Go down

Re: how to call single code multiple times?

Post by anbarasi on Mon Apr 15, 2013 4:23 pm

hi .... its executing many times but i want to randomly select the options start from 1 to 150 options . now in this above code i can perform only first number 1 option , remaining 149 i could not do .

plz help

anbarasi
Amateur
Amateur

Posts : 40
Join date : 2012-04-30
Age : 28
Location : chennai

Back to top Go down

Re: how to call single code multiple times?

Post by anbarasi on Mon Apr 15, 2013 6:41 pm

need to change that store |1|i command , like to store 2 then 3 etc..

anbarasi
Amateur
Amateur

Posts : 40
Join date : 2012-04-30
Age : 28
Location : chennai

Back to top Go down

Re: how to call single code multiple times?

Post by ccox on Mon Apr 15, 2013 9:46 pm

anbarasi wrote:need to change that store |1|i command , like to store 2 then 3 etc..

That is exactly what store| javascript{storedVars.i++} does! It increments i each time the loop is ran. Since that store|1|i command is outside of the loop, it will not be executed again, which is why we update i within the loop. Is it not updating the value of i? Put in an echo command in there to see if it is outputting the correct value. If you can, post your code.

Also make sure you can select from your drop down by the index.

To do this randomly you will need a lot more logic to store what numbers you have already selected and make sure you do not select them again, unless you don't care about selecting duplicates.

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 31
Location : Denver, CO

Back to top Go down

Re: how to call single code multiple times?

Post by anbarasi on Tue Apr 16, 2013 6:46 pm

yes the echo command shows the count .

my code is

select
name=servertypes
index=1 /// here i have till 150 options
// then im selecting that option and adding to the db


now my script has to ask the user which option they need to add if the user says option 2 i have make the script to choose the index=2 and proceed the steps adding to the db. again then i have to ask the user whether they need to add any option more if they say yes and gives any option my script has to go to that option again. no matter of duplicates.

anbarasi
Amateur
Amateur

Posts : 40
Join date : 2012-04-30
Age : 28
Location : chennai

Back to top Go down

Re: how to call single code multiple times?

Post by ccox on Wed Apr 17, 2013 10:01 pm

Correct me if I'm wrong, but you want a js pop-up where you can just enter the index of the option?

storeEval | prompt("Enter the index") | index
select | name = servertypes | index=${index}

If you want to wrap that into a loop you can do this:
store | 0 | i
while | ${i}<150 |
storeEval | prompt("Enter the index") | index
select | name = servertypes | index=${index}
//And whatever other steps you need to add to the DB
store | javascript {storedVars.i++}
endWhile

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 31
Location : Denver, CO

Back to top Go down

Re: how to call single code multiple times?

Post by anbarasi on Fri Apr 19, 2013 6:53 pm

it works perfectly... thanks much


but what should i do if i want to change that
storeEval | prompt("Enter the index") | index to
storeEval | confirm ("Enter the index") | index


and if i click yes can perform the loop but if i want to cancel the steps how can i do .. right now the script goes continuously ...

anbarasi
Amateur
Amateur

Posts : 40
Join date : 2012-04-30
Age : 28
Location : chennai

Back to top Go down

Re: how to call single code multiple times?

Post by ccox on Tue Apr 23, 2013 5:16 am

Why not just stop the script? That seems like a lot of unnecessary effort and user interaction to get the same result.

ccox
Master
Master

Posts : 205
Join date : 2012-01-06
Age : 31
Location : Denver, CO

Back to top Go down

Re: how to call single code multiple times?

Post by Sponsored content Today at 3:19 am


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum