12-11-2009, 07:29 PM
I am copying two codes where we are not convinced with the output.
Code 1:
On executing this code, QTP shows error at "Browser("hwnd:="&hwndMain).Navigate urlToNavigate" step. If we change this step to "IE.Navigate urlToNavigate" then it works. On the fly we are creating browser object with some specific hwnd value and it should work.
Code 2:
On executing this code, message is displayed for 1 opened browser instead of 2. And second thing if we change the "GetROProperty("title")" to hwnd then we got three different hwnd values instead of two.
Can you please look into the issue and correct us at earliest.
Thanks.
Code 1:
Code:
Dim IE
Set IE=createObject("internetExplorer.application")
IE.visible=true
hwndMain=IE.HWND
Window("hwnd:="&hwndMain).Maximize
IE.Navigate "about:blank"
urlToNavigate="www.google.com"
Browser("hwnd:="&hwndMain).Navigate urlToNavigate
Set IE = Nothing
On executing this code, QTP shows error at "Browser("hwnd:="&hwndMain).Navigate urlToNavigate" step. If we change this step to "IE.Navigate urlToNavigate" then it works. On the fly we are creating browser object with some specific hwnd value and it should work.
Code 2:
Code:
Dim IE,IE1
Set IE=createObject("internetExplorer.application")
IE.visible=true
hwndMain=IE.HWND
msgbox hwndMain
Window("hwnd:="&hwndMain).Maximize
IE.Navigate "about:blank"
IE.Navigate "www.google.com"
Set IE1=createObject("internetExplorer.application")
IE1.visible=true
hwndMain1=IE1.HWND
msgbox hwndMain1
IE1.Navigate "www.gmail.com"
Set bDesc = Description.Create()
bDesc("application version").Value = "internet explorer 7"
Set bColl = DeskTop.ChildObjects(bDesc)
Cnt = bColl.Count
MsgBox "There are total: "&Cnt&"browsers opened"
For i = 0 To (Cnt -1)
MsgBox "Browser : "&i&" has title: "& bColl .GetROProperty("title")
Next
Set bColl = Nothing
Set bDesc = Nothing
Set IE = Nothing
Set IE1 = Nothing
On executing this code, message is displayed for 1 opened browser instead of 2. And second thing if we change the "GetROProperty("title")" to hwnd then we got three different hwnd values instead of two.
Can you please look into the issue and correct us at earliest.
Thanks.