Micro Focus QTP (UFT) Forums
DO UNTIL - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: DO UNTIL (/Thread-DO-UNTIL)



DO UNTIL - wheelercha - 12-15-2009

I have two actions. 1 logs me into a site as s specific user with specific roles (users stored in a dat table). The other navigates to a webpage within the site and checks to see if a menu option exists.

I want to login as a user if the menu option exist continue forward and finish the test . If not - log out as the first user and start with second user in datatable from the first action.

Any ideas?


RE: DO UNTIL - niranjan - 12-15-2009

You can try like this: Create a master action and in that create two actions (one for first user- say A and another for second user - say B)
login as the first user (Master action).
Use a IF statement to check the menu option (IF NO)
Then Call Action A and continue forward
Else
Log out and call Action B

Hope it helps!


RE: DO UNTIL - wheelercha - 12-15-2009

Thanks Niranjan. That is very close to what I want but not quite. Here is what I have done. Action 1 logs me in with a user from the datatable. Action 2 uses an if to check the menu option and if not it logs me off then starts me at the beginning again like I want. The only thing now is telling it to advance forward in the data table. I am not quite sure how to do that. What happens now is it will run in a loop using the same user over and over. :-) Here's my code for Action 2. The main row is the one with the arrow. Is there a way I can set the first action to look at the next user in the data table or pass a parameter like I am trying to do there?


Code:
CheckMenuOption = Browser("Main Menu").Page("Main Menu").WebElement("Reporting").Check (CheckPoint("Reporting"))
If CheckMenuOption THEN
Browser("Main Menu").Page("Main Menu").WebElement("Reporting").Click
ELSE
Browser("Main Menu").Page("Main Menu").Link("@Home").Click
Browser("Main Menu").Page("Staff").Link("Logoff").Click
Browser("Main Menu").Page("Login").Link("Log in Using Desktop Username/").Click
-->>> RunAction "Masq until Menu Option displays", i = datatable.SetNextRow
END IF
Browser("Main Menu").Page("Main Menu").WebElement("Category Total Report").Click



RE: DO UNTIL - wheelercha - 12-16-2009

Actually - I solved this. I used the Global Data Sheet. Therefore the entire script runs from it and there was no need to pass a parmeter back and forth.