Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

clickAndWait with loop

View previous topic View next topic Go down

clickAndWait with loop

Post by guicps89 on Thu Mar 14, 2013 8:50 pm

Hi everyone,

I'm using Selenium IDE and there is a step on my code that needs to click on a link called "Approve".
The problem is that this link may appear up to 4 times (you click once, the page is refreshed and the link appears again). So, I need to know if there is a way to create a loop to my script click on this link while it exists, and if it is not found anymore, continue to execute the next steps.

Currently, I'm using like this:

COMMAND | TARGET
clickAndWait | link=Approve
clickAndWait | link=Approve
clickAndWait | link=Approve
clickAndWait | link=Approve

I put it 4 times in a row, but if the links appears just 3 times, for example, the 4th command gets error because it did not find the link and stops the script and don't execute the other next steps.

guicps89

Posts : 5
Join date : 2013-03-14

Back to top Go down

Re: clickAndWait with loop

Post by ccox on Wed Mar 20, 2013 1:45 am

storeElementPresent | link=Approve | linkExists
while | storedVars.linkExists |
clickAndWait | link=Approve
storeElementPresent | link=Approve | linkExists
endWhile |

Let me know if this doesn't work

ccox
Master
Master

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

Back to top Go down

Re: clickAndWait with loop

Post by guicps89 on Wed Mar 20, 2013 2:37 am

It worked, I did like this, thanks a lot:

storeElementPresent | link=Approve | ApproveTrue
while | ${ApproveTrue} == true |
clickAndWait | link=Approve
storeElementPresent | link=Approve | ApproveTrue
endWhile | |

guicps89

Posts : 5
Join date : 2013-03-14

Back to top Go down

Re: clickAndWait with loop

Post by sunny mehndiratta on Fri Mar 22, 2013 4:28 pm

guicps89 wrote:It worked, I did like this, thanks a lot:

storeElementPresent | link=Approve | ApproveTrue
while | ${ApproveTrue} == true |
clickAndWait | link=Approve
storeElementPresent | link=Approve | ApproveTrue
endWhile | |



y did u add this line again in ur code.can u help me out

storeElementPresent | link=Approve | ApproveTrue

sunny mehndiratta
Regular Participant
Regular Participant

Posts : 25
Join date : 2013-03-22

Back to top Go down

Re: clickAndWait with loop

Post by guicps89 on Fri Mar 22, 2013 6:47 pm

y did u add this line again in ur code.can u help me out

Hi sunny,

The first time that this line appears is to check if the link "approve" exists, and if it exists, it enters in the While loop and execute the commands. Once this is a While loop, it must have a condition to stop, or it will loop forever. That's why this line you mentioned appears 2 times, the second time is to check again if this link still exists, and if not, it will exit the loop.

guicps89

Posts : 5
Join date : 2013-03-14

Back to top Go down

Re: clickAndWait with loop

Post by sunny mehndiratta on Sat Mar 23, 2013 1:39 am

thanks for the solution

sunny mehndiratta
Regular Participant
Regular Participant

Posts : 25
Join date : 2013-03-22

Back to top Go down

Re: clickAndWait with loop

Post by Sponsored content Today at 9:01 pm


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