Micro Focus QTP (UFT) Forums
Opening Multiple Browsers Simultaneously using QTP - 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 Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Opening Multiple Browsers Simultaneously using QTP (/Thread-Opening-Multiple-Browsers-Simultaneously-using-QTP)

Pages: 1 2


Opening Multiple Browsers Simultaneously using QTP - Faisal Rashid - 10-21-2009

Hi ,

I am working on a Siebel Application and I want to open multiple browsers( eg=10 browsers) simultaneously using QTP having same url but having different User Name and Password to complete my task .

When I use loop , it does open multiple browsers but only one browser opens as Siebel application and the remaining as other browsers which is not required by me .I guess it is the lack of unique property which QTP fails to identify .

How do i make use of creation time of browsers here to identify each siebel application .Any suggestions ??

Regards,
Faisal


RE: Opening Multiple Browsers Simultaneously using QTP - basanth27 - 10-21-2009

Use it this way,
maybe a rough code, alter to your needs...
Code:
For i = 0 to 10
    
    Browser("CreationTime:="&i).Navigate Datatable("urlpath")
Next

Store your Url's in the Datatable and then input it one by one into the for loop. As i said it is very rough, please alter it to your needs. The base concept remains intact.


RE: Opening Multiple Browsers Simultaneously using QTP - Faisal Rashid - 10-22-2009

For Opening Multiple Browsers Simultaneously , I am using For Loop to open the browser multiple times.The browser in my case is my Siebel Application.

Then I use another for loop and set the current row of DataTable in which I have provided different User Names and Passwords which I need to use to login to my siebel application multiple times which I open using 1st For loop.

I am able to login to my Siebel application with user name and password as provided in DataTable but it does not take user name and password for next opened browsers .Any Suggestions??

Regards,
Faisal


RE: Opening Multiple Browsers Simultaneously using QTP - Saket - 10-22-2009

you can use a single for loop to open a browser and within that loop you can login to application as in the datatable.


RE: Opening Multiple Browsers Simultaneously using QTP - Faisal Rashid - 10-22-2009

Hi,

I have tried with Single For loop also but there was no success . Please find the details of my approach which i had used before using a Single For loop to open browsers and login to application :

My Approach :

It takes the User name and password for the first browser and logs into it , but it does not take the user name and password for the other web browsers .I have stored the user name and password in the data table and using for loop I am logging to the browser. Please find the details below:

Note: It is the same browser which i need to open multiple times using different user name and password.

1) I am opening my multiple browsers with the below concept :

Code:
For i = 0 to var_RowCount

Set oIE = CreateObject("InternetExplorer.Application")

oIE.visible=true

oIE.navigate "URL"   ------ have provided the url of my web browser

Next

2)Next I am setting the current row of data table in a for loop to traverse through the loop and complete my actions . But it does not allow me to log in to next browsers as it does not take user name and password from the data table (it still shows the focus on first row of data table).I am using below concept for this :

Code:
For i = 0 to var_RowCount

DataTable.SetCurrentRow (i)

Browser("index:=i").Page("title").WebEdit("name:=SWEUserName").Set DataTable("User_Name", dtGlobalSheet)

Browser("index:=i").Page("title ").WebEdit("name:=SWEPassword").Set DataTable("Password", dtGlobalSheet)

Browser("index:=i").Page("title ").Image("name:=Image","repositoryname:=LoginButton").click

wait(10)

Next

Note:
1)How else can I make the focus to the next rows of Datatable other than using DataTable.SetCurrentRow (i) in a for loop.
2)Or how to get the focus to next browsers after logging into first browser.

Regards,
Faisal


RE: Opening Multiple Browsers Simultaneously using QTP - Saket - 10-23-2009

using creationtime instead of index should solve the issue
e.g.
Code:
Browser("CreationTime:=i").Page("title").WebEdit("name:=SWEUserName").Set DataTable("User_Name", dtGlobalSheet)



RE: Opening Multiple Browsers Simultaneously using QTP - venkatbatchu - 10-23-2009

I agree with saket solution because while handling multiple browsers it would be better go with creation time as ordinal identifier
Thanks saket for refreshing me about this...


RE: Opening Multiple Browsers Simultaneously using QTP - basanth27 - 10-23-2009

My hunch states that there is a issue with the syntax. I am not sure if it is a typo from your end but passing variable would be like,

Browser("index:="&i)

As saket & Venkat have mentioned, creationtime is the right approach, however i see saket also mentioned it as ,

Browser("CreationTime:=i") and i believe Browser("CreationTime:="&i) should be the right one.

Correct me if i am wrong saket & Faisal.


RE: Opening Multiple Browsers Simultaneously using QTP - Saket - 10-23-2009

Good catch Basanth, Thanks for pointing out.


RE: Opening Multiple Browsers Simultaneously using QTP - Faisal Rashid - 10-23-2009

First of all Thanks for your support.Basant You are correct and it is the way it should be .Thanks!

I tried with both Index as well Creation time property , though it holds good when we script as Browser("CreationTime:="&i) .

However I am able to log into the application with the first user name and password as provided in the datatable.It then goes to next row in the datatable .

On reaching to the statement :
Code:
Browser("CreationTime:="&i).Page("title:= ").WebEdit("name:=SWEUserName").Set DataTable("User_Name", dtGlobalSheet)
, it does not proceed further as it throws an error :

”You already have a Web Browser accessing the current Web Session.Multiple Browsers are not allowed to share the same web session.To launch a new web session , please open a new web browser by accessing your command prompt or your desktop .

On Reaching this Statement :

Code:
Browser("CreationTime:="&i).Page("title:=Mobily CRM - Integration").WebEdit("name:=SWEUserName").Set DataTable("User_Name", dtGlobalSheet)

It gives Runtime error … Cannot find WebEdit object’s parent[Browser]


Sorry I am unable to attach File as an attachment herebecause of difficultiy in attaching here .