Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to identify top browser from a lot of browsers?
#1
Solved: 11 Years, 3 Months, 3 Weeks ago Sad 
Hello,
Please read the following script

Code:
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Links = Browser("title:=Google").Page("title:=Google").ChildObjects(oDesc)
Msgbox "Total links: " & Links.Count
Links(3).click
Browser("title:=.*").back

When the Browser("title:=.*").back is executed, there is a error message:"The "[ Browser ]" object's description matches more than one of the objects currently displayed in your application. Add additional properties to the object description in order to uniquely identify the object."

How can we identify the current browser after Links(3).click without using additional properties?

Thank you.
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Without using additional properties?
May I know why you don't want to use additional properties?

Otherwise you can use an ordinal identifier like 'creation time' to uniquely identify a browser.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
I think you have to add "index" property at last , without additional properties , i don't know if it's possible to identify lot off window with the same properties ...
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Hello,

What I means is that if after Links(3).click, the browser navigates to a new page and I don't know this new page's properties such as title, name, etc. Then what methods can we use to identify this new page(browser with unknown title and other proterties). If we can identify this new page then we can do something like browser("title of new page").back.

usually the new page should be on the top of a lot of browsers, then how to identify it, or how to identify any top browser on a list of browsers?

Thanks.
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
In this case add 'location' property in the object repository and set it to 0 . That will resolve your problem
Reply
#6
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Guocnc,
Pls take "hwnd" property of that browser.
Use that property to Identify that Browser.

Code:
sHwNd = Links(3).GetROProperty("hwnd")
Links(3).click
Browser("hwnd:=sHwNd").Back

Hope this will work

Thanks
VENKATA REDDY
Reply
#7
Solved: 11 Years, 3 Months, 3 Weeks ago
Thanks for elsekra.
Using object repository must do recording first. I want to use Descriptive programming without object repository.
Thanks for VENKATAREDDY_M,

Link(3) is the collection of link objects. I use Object spy to try to find the property hwnd of link object, but I can not find it. How to find it?

I am thinking maybe we can use property:createtime of Browser object to identify the top browser
Reply
#8
Solved: 11 Years, 3 Months, 3 Weeks ago
Hwnd property is availabe for page and browser object.find hwnd property at this object level only...
Reply
#9
Solved: 11 Years, 3 Months, 3 Weeks ago
HI guocnc,

Try with the below code ..... Your requirement will be solved now ...Smile

Code:
Set PDesc=Description.Create
        PDesc("micclass").Value="Page"
  Set LDesc=Description.Create
        LDesc("micclass").Value="Link"

   Set Pages=Browser("CreationTime:=0").childObjects(PDesc)
   Set Links=Pages(0).ChildObjects(LDesc)
   Links(3).Click
   Browser("CreationTime:=0").Back
Reply
#10
Solved: 11 Years, 3 Months, 3 Weeks ago
Thanks for sreekanth chilam
CreationTime:=0 only identifies the first browser in a desktop instead of the top browser except that there is only one browser in a desktop.
I do it in another similar way. First calculate the total no of the browsers, then the top browser is the CreationTime:=total-1. I don't know whether there is any exception for this solution which works in normal conditions. Please see the following code.

Code:
Set oDesc = Description.Create()
oDesc("micclass").Value = "Link"
Set Links = Browser("title:=Google").Page("title:=Google").ChildObjects(oDesc)
Links(3).click

Dim oDescB
Set oDescB=Description.Create()
oDescB("micclass").Value="Browser"
Set oDescB = DeskTop.ChildObjects(oDescB)

Browser("CreationTime:=" &  oDescB.count-1).back

Set oDescB=nothing
Set Links=nothing
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Running test with multiple browsers mvi63 0 2,771 06-25-2014, 06:49 PM
Last Post: mvi63
  Cannot find the "[ WebEdit ]" object's parent "[ Browser ]" (class Browser). Verify t Divya Roopa 1 8,458 03-11-2014, 12:13 PM
Last Post: devarapallliramana
Rolleyes QTP 11 not identify PDF Browser laxminaranaya 1 2,390 02-25-2014, 01:34 PM
Last Post: guin.anirban
  Multiple 2 IE browsers are being displayed VA1405 1 1,876 01-15-2014, 07:20 AM
Last Post: basanth27
  Will Object Property Differ across browsers?? qtplearner88 7 4,027 07-30-2013, 07:18 PM
Last Post: qtplearner88

Forum Jump:


Users browsing this thread: 3 Guest(s)