Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Issue related to reusable Action
#1
Solved: 10 Years, 9 Months, 1 Week ago
Hi

I have created 3 scripts in QTP.one is for login.
Now i want to use this login script to other two scripts let's say Script1,Script2..So i made the login as reusable and called it to other scripts..Now fight is that,with login its localsheet is also fetched..But i want to use different user name to get login to these two different script.
Let's say Login script contain username as galstar@gmail.com.

Script 1 need login through galstar1@gmail.com
and Script 2 need login through galstar2@gmail.com..


How should i proceed for this...Please help me to do it..
Thank you....
Smile
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago At 
Hi

Well Call By Action will not work here.Instead of that create a generic function for Login to the Application.
Ex:
Code:
Function Login(txtUserName,txtPassword)
----Function Body--------------
End function
Call this function where you want and pass the required inputs for the function parameter.

~Regards
Reply
#3
Solved: 10 Years, 9 Months, 1 Week ago
Thanks for reply..

I did the same..
I have created a global function
Code:
login(byval username,byval passwd)
{
Browser("..").Page("..").WebEdit("ctl00$uxMNJDefaultContentPlace").Click
Browser("..").Page("..").WebEdit("ctl00$uxMNJDefaultContentPlace").Set username
Browser("..").Page("..").WebEdit("ctl00$uxMNJDefaultContentPlace_2").Click
Browser("..").Page("..").WebEdit("ctl00$uxMNJDefaultContentPlace_2").Set Password
Browser("..").Page("..").Link("Sign In").Click
}
Then i passsed the argument while calling function in the script from datatable...
for that i read the value of username and passwd from datasheet.
and call the function..
i called as login(username,password)...
i copied all the login scripts to function..and set username and password as arguments..
but still login is not working..


May b i am doing wrong approach...would you plz help me to resolve it...


Thank u so much....



Thanks
Reply
#4
Solved: 10 Years, 9 Months, 1 Week ago
To make it more generic try to use an external excel.
In the run time import that sheet to datatable and take the values.

I hope this will solve your problem.
Reply
#5
Solved: 10 Years, 9 Months, 1 Week ago
Create a FunctionFile and load it. After that call the function in every script and use the DataSheet.

Incase if you have created seperate scripts then you can use Global dataSheet.
Ex:
Code:
Login(DataTable["UserName",dtGlobalSheet],DataTable["Password",dtGlobalSheet)]

Incase if you have created seperate Actions in one script then you can use Action Specific dataSheet.

Code:
Login(DataTable["UserName","Action1"],DataTable["Password","Action1")]

Hope this will help you!
Reply
#6
Solved: 10 Years, 9 Months, 1 Week ago
Hi,

Thanks dear for such a clear solution...Smile
I am using global datasheet for username and password as i have mentioned in my previous reply....But the call of function shows no effect in the script as my website is not getting logging in....Sad

can you plz tell me why is this happening??

Thanks


O thanks...now it's working..but still one issue now ,plz solve it too...
As for login i did record and play..for everyscript i am doing same..now what i did is that i copied the script of login in notepad and saved as .vbs..:-p
Now while calling this login script it works in the same script from where i copied but not in other scripts..as functions containing the objects which are not in the repository of other scripts..Sad...

Donn know what to do...

please help me out...

Thanks
Reply
#7
Solved: 10 Years, 9 Months, 1 Week ago
Do one thing first create Object Reporsitory. Either Global or Local Object repository.

As the Login screen is same then Global Object repository will work for you.

So before executing the script upload Object Repository and Function File and run the script.

Hope this will help you.
Incase if it is not clear then please provide me your code and resource file.

~Regards
Reply
#8
Solved: 10 Years, 9 Months, 1 Week ago
Hi,

can you please help me in creating local object repository.May be i know it.But still i think i donn have any idea to create it seperatly and then use it in my scripts...
How to maintain relation in login function and object repository..?

Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Action Parameterization Issue Slothman 1 1,582 10-31-2020, 01:05 PM
Last Post: Ankur
  QTP system related issue Bharathi Kanagarajan 1 1,978 09-12-2015, 11:28 PM
Last Post: ADITI1992
  Issue related to dropdown selection(Please help urgent) excellentpawan123 2 4,053 05-31-2014, 12:00 PM
Last Post: excellentpawan123
  Non-reusable action - doubt srsaritha 1 3,378 10-16-2012, 05:04 PM
Last Post: richa07
  how to call reusable actions by passing parameters.? Arun091 0 3,737 08-16-2012, 07:28 PM
Last Post: Arun091

Forum Jump:


Users browsing this thread: 2 Guest(s)