This is a migrated thread and some comments may be shown as answers.

Logical Loop Until Redirect

7 Answers 116 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Andrew
Top achievements
Rank 1
Veteran
Iron
Andrew asked on 16 Oct 2013, 03:42 PM
I want to implement a loop that will preform 2 statements a 'click' and a 'wait' till the page does a redirect how can I do this?

Thanks
Andrew

7 Answers, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 2
answered on 16 Oct 2013, 05:41 PM
Are you trying to loop X number of times (http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/logical-steps/loop.aspx), or loop conditionally until another verification is met (http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/logical-steps/while-loop.aspx)?

Simple loop demo and while loop demo (not good because it will go on indefinitely) attached.

These are using a wait to determine that the page has indeed changed by checking the content of the name span.  You could do a coded step to verify against URL's, or any other sort of verification.

If you need something more specific, please provide a bit more detail to help with the exact issue.

**EDIT**

A feature I've never used...there is a "Wait for URL" option: http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/add-custom-step/wait-for-url.aspx.

Do you know URL's the automation should be going to?

0
Andrew
Top achievements
Rank 1
Veteran
Iron
answered on 16 Oct 2013, 07:13 PM
I would need to be a conditional loop, that would loop until the page redirects.

I could to a coded step, but I was hoping to get it to work without doing that.

if my while loops verification test could be on if the element exists or not then I would think that would
work because the element would not exist of the new page. but I do not think you can do that.

I tried this:
WHILE (Verify element 'CphBaseMasterBodyCphAuthenticatedRightColumnEmCheckPDFStatusLinkButton1Link' 'is' visible.) THEN

but is caused an error because the page redirects in the loop and the element being tested does not exist.
0
Andrew
Top achievements
Rank 1
Veteran
Iron
answered on 16 Oct 2013, 07:30 PM
I got it to work....  I opened up the dom and built the verification off the form action value.

WHILE (Verify attribute 'action' has 'Contains' value of 'CheckPDFStatus.aspx' on 'Form1FormTag') THEN
0
Daniel
Top achievements
Rank 2
answered on 16 Oct 2013, 07:44 PM
Glad to hear you got it figured out.
0
Accepted
Shashi
Top achievements
Rank 1
answered on 16 Oct 2013, 08:15 PM
Andrew,

You may also be able to implement this using While (Verify Not Exists) on an element on the page it redirects to - or While (Verify Exists) on an element on the page that you start on.  However, it takes multiple steps to construct this statement:

a) FIrst record a Wait for Exists on the element of the destination page (if you are implementing the first option) or an element on the source page (if you are implementing the second option).
b) Convert to Wait for Not Exists (if you are implementing the first option)
b) Convert Wait to Verify (using the command on the Step Context menu).
c) Convert to a WHILE loop using the command on the Step context menu.

HTH,
Shashi
p.s. Telerik:  It would be good to have a command to directly record a Verify Exists statement (with UI workflow being same as that for Wait for Exists).
0
Andrew
Top achievements
Rank 1
Veteran
Iron
answered on 17 Oct 2013, 02:04 PM
I agree a Verify Exists statement  and a Verify NOT Exists statement would be good in the quick validations screen
0
Mario
Telerik team
answered on 22 Oct 2013, 03:59 PM
Hello Andrew/Shashi,

@Andrew - I'm glad to see you were able to find a solution to your original problem.

@Andrew/Shashi - Thank you both for the suggestion of adding Verify Exists/ExistsNot to the Quick Tasks menu, I have created this entry in our public Feedback portal for further consideration of this feature.

Please let me know whether you have any additional questions.

Regards,
Mario
Telerik
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Andrew
Top achievements
Rank 1
Veteran
Iron
Answers by
Daniel
Top achievements
Rank 2
Andrew
Top achievements
Rank 1
Veteran
Iron
Shashi
Top achievements
Rank 1
Mario
Telerik team
Share this question
or