Micro Focus QTP (UFT) Forums
How to use same script for multiple URLs - 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: How to use same script for multiple URLs (/Thread-How-to-use-same-script-for-multiple-URLs)

Pages: 1 2 3


RE: How to use same script for multiple URLs - QTPScript - 08-30-2012

PLEASE SEE ATTACHMENT. I THINK THAT'S THE PROBLEM. PLEASE CONFIRM ONCE PROBLEM SOLVED SO THERE USER CAN USER CAN UNDERSTAND EASILY.

Code:
DataTable.Import("C:\nis.xls")

For i =1 to DataTable.GetSheetCount
DataTable.SetCurrentRow i

Print DataTable("Username",dtGlobalSheet)
Print DataTable("password",dtGlobalSheet)

Print"id"& DataTable.Value("Username")
Print DataTable.Value("password")

Next


Above code is working and tested. please see


RE: How to use same script for multiple URLs - mansis - 08-31-2012

Hi,

Thanks a lot.. Now the described error is removed.. it was because of while pasting code, it copies wrong ", which is now corrected.

Now new error occurs which is attached.... Please help me with it..


RE: How to use same script for multiple URLs - Sathiya - 08-31-2012

Before loop try to get the number of rows and assign that to some variable like "rowcount=DataTable.RowCount"
msgbox rowcount

For i=rowcount
xxxx
yyyy
Next


RE: How to use same script for multiple URLs - mansis - 08-31-2012

Hi,

Tried as per your suggestion.. but same error occurs.. pls review attached screen shot..

Thanks,
Mansi.


RE: How to use same script for multiple URLs - Sathiya - 08-31-2012

Try with the below one


Code:
sVal=Datatable.GetRowCount
For i = sVal



RE: How to use same script for multiple URLs - mansis - 08-31-2012

Hey,, now its fully working, without error Smile

Thank you so much..

But still I have one issue.. Please review below code and attached snap shot of datasheet.. According to me, on running this script, it should first login into first URL and then next one and after that it should be stopped.. But with below code, it first login into with first URL, then next one and "AGAIN login with first URL and second one" which is wrong.. Can you please corrrect me what is wrong in below code??

--------------
Code:
DataTable.Import("D:\Book1.xls")

For i=1 to Datatable.GetRowCount
DataTable.SetCurrentRow i
SystemUtil.Run DataTable("URL",dtGlobalSheet)
Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtUsername").Set DataTable("Username",dtGlobalSheet)
Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtPassword").Set DataTable("Password",dtGlobalSheet)
Browser("InSync :: Login").Page("InSync :: Login").WebButton("Login").Click

'Select facility'
'Browser("InSync :: Login").Page("InSync :: Login_2").WebList("ddlFacility").Select ("Local Facility")
Browser("InSync :: Login").Page("InSync :: Login_2").WebButton("Ok").Click

Browser("InSync :: Login").Close
Next

------------


RE: How to use same script for multiple URLs - mansis - 08-31-2012

Hi,

Can anyone please help me urgently....

When I run below script, it performs goes into infinite loop.. Consider that in datasheet I have 5 rows in my data sheet, it executing scripting multiple times, though all 5 URL are once opened and described operations are mentioned. It should open each 5 URL one time instead of multiple time.. Please let me know where I am wrong in below script?

---------------

Code:
DataTable.Import("D:\Book1.xls")

For i=1 to Datatable.GetRowCount
DataTable.SetCurrentRow i
SystemUtil.Run DataTable("URL",dtGlobalSheet)
Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtUsername").Set DataTable("Username",dtGlobalSheet)
Browser("InSync :: Login").Page("InSync :: Login").WebEdit("txtPassword").Set DataTable("Password",dtGlobalSheet)
Browser("InSync :: Login").Page("InSync :: Login").WebButton("Login").Click
Browser("InSync :: Login").Page("InSync :: Login_2").WebList("ddlUsers").Select DataTable("User",dtGlobalSheet)

'Select facility'
Browser("InSync :: Login").Page("InSync :: Login_2").WebButton("Ok").Click
Wait (1)

'Access Scheduler
Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image2").Click
Wait (1)

'Access Patient Search
Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image3").Click
Browser("InSync :: Login").Page("InSync :: Patient Search").Image("Edit Patient").Click
Wait (1)

'Access Facesheet
Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image4").Click
Wait (1)

'Access New Charge
'Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$Image5").Click
'Wait (1)

'Access Document Manager
Browser("InSync :: Login").Page("InSync :: Dash Board").Image("ctl00$Header1$ibtndocumnetmgr").Click
Wait (1)

Browser("InSync :: Login").Close
Next

-----------

Thanks,
Mansi.


RE: How to use same script for multiple URLs - mansis - 09-01-2012

Help me pleaseeeeeeeeeeee...


RE: How to use same script for multiple URLs - basanth27 - 09-01-2012

Is the test settings for datatable run on all rows?


RE: How to use same script for multiple URLs - mansis - 09-01-2012

Hi Basanth,

Yes Test setting for datatable run on all rows, which was wrong.. Due to which loop enters in infinite... Now it is working fine for me..

Thanks a lot to all of you for your precious help. Smile .. With all of your help, I was able to prepare a complete script for my project..Thanks again..