Micro Focus QTP (UFT) Forums
If page does not exist - skip go to another action - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: If page does not exist - skip go to another action (/Thread-If-page-does-not-exist-skip-go-to-another-action)



If page does not exist - skip go to another action - janriis - 10-11-2010

Hi all

My web app handles differently depending on the input.

If input is "Company type A" then page 1,2,3,4,5 is shown in the flow (you navigate from each page by pressing next).

If input is "Company type B" then page 1,2,4,5 is shown thus skipping page 3.

How do i handle this without having to have to seperate scripts, one for each company type ?


RE: If page does not exist - skip go to another action - KavitaPriyaCR - 10-11-2010

Hi
Can you pls tell me what exactly you have to do on pages?
If you are stuck in clicking next button (If next button is disabled for 4th time in 2nd condition) or accessing the particular page?


RE: If page does not exist - skip go to another action - janriis - 10-11-2010

I have one action for each page in my Web app called ActionPage1, ActionPage2 ...etc.

All pages (actions) except last page have Next buttons, and thats the problem, because if the script clicks next, the script "thinks" that the next page is 3, but its actually 4. What i need the script to do is:

1. Identify the page, could be by checking if a specific text exists
2. If text exists (meaning page 3 is not skipped), the script should perform as usual on page 3 (could be verify text).
3. If text does not exist (meaning page 3 is skipped), the script should ignore the code on page 3 and perform the code of page 4 (ActionPage4)


RE: If page does not exist - skip go to another action - KavitaPriyaCR - 10-12-2010

Then try this,
Code:
For i= 1 To MaxCount
' use any property value, i have taken text to describe here for example
If (Browser().Page().WebButton("text:=Next").Exists(0)) Then
     Browser().Page().WebButton("text:=Next").Click
   ' Here do what ever you want
   ' Call the "actionPage"&i >> here you can use i to call the particular action.
End If



RE: If page does not exist - skip go to another action - Imtiaz-QA - 10-12-2010

Simply record the script and then handle it through if -else

for example

if company a
then add the statements & actions of company a [copy paste by already recorded script]
if company b

then add the statements & actions of company b [copy paste by already recorded script]