![]() |
Controlling Actions - 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: Controlling Actions (/Thread-Controlling-Actions) |
Controlling Actions - mahadevan.swamy - 10-21-2008 Hi, I have a test with 5 actions starting with "Login" action and ending with "Close" action. The "Login" action is parametrized with 2 id's where QTP can login to the application using these 2 ID's. There is one action in the test that should not be executed when QTP comes to Login ID 2. For example, there are two ID's: UserA and UserB and there are 5 actions: Login, Sort, Print, Query, Close. UserA can execute all 5 actions in the test whereas UserB should not touch the Print action. How do I control this? Any ideas? RE: Controlling Actions - krishnas.tester - 10-21-2008 Hi, Its possible to contoll the acitons. First save the test which contains your 5 actions, then go to the local path of the script (i.e. C:\test\), open the script folder. you can find total 6 action folders there like Action0...Action5 open Action0-->open script file(notepad file) ->follow the below steps and save the script and run in QTP Suppose if you dont want to execute Action2 in second Iteration use the below script: '################ Code: RunAction "Action1", oneIteration Regards KrishDeep Chennai RE: Controlling Actions - mahadevan.swamy - 10-21-2008 Hi, I tried the method that you told me and it didn't work for me. Do you have any other method where I can integrate the IF statement in the actions. I don't know how to introduce an IF statement in VB and I am hoping if you could give me an idea on how to do it. This is my script from Login Action: Code: Browser("ExxonMobil Authentication").Page("ExxonMobil Authentication").WebEdit("username").Set DataTable("username", dtGlobalSheet) The Global Sheet has 2 usernames and passwords: UserA and UserB. And this is my script for Print Action: 'This action only views the report Code: Browser("Imperial Oil Limited").Page("Imperial Oil Limited").Frame("_sweview").Link("Print").Click Do you have any ideas on putting an IF statement? Please let me know. Thanks Mahadevan Swamy RE: Controlling Actions - mahadevan.swamy - 10-21-2008 I have tried this method but it doesnt work: Login Script: Code: Browser("ExxonMobil Authentication").Page("ExxonMobil Authentication").Sync Print Script: 'This action only views the report Code: If user = "UserB" Then Can anybody tell me how to make this work? Thanks RE: Controlling Actions - somisays - 10-22-2008 Hi, Try the following script... Write this script in Login Action.. Code: If DataTable("username",dtGlobalSheet) = "UserA" then RE: Controlling Actions - mahadevan.swamy - 10-22-2008 Hi, I have tried the script that you are telling me. However there is one small problem. In the Login Action, when we use IF statements and call to the existing actions, at the very end we have this: RunAction "Close", oneIteration which closes the application. Then after the Login action, QTP runs the sort action and when the application is closed, testing error happens. Your idea is right and I used this code If DataTable("username",dtGlobalSheet) = "UserB" in the print action to restrict this action to A only. It is working. Thanks for the idea ![]() RE: Controlling Actions - MR21135 - 11-07-2008 Hi, At the end use ExitRun(). this will stop the executions |