Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Open Browser
#1
Not Solved
Hi,
i have created a function to open a browser, but i don't understand one thing. Here the code:

Code:
Function FunOpenBrowser()
    
    dim objexpl, brow, pag, hwnd(1)
    set objexpl = CreateObject("InternetExplorer.Application")
    objexpl.visible = true
    objexpl.navigate "http://www.vodafone.it"
    wait(5)
    
    Set brow  = Browser("hwnd:=" & objexpl.hwnd)
    Set pag   = brow.Page("title:=" & objexpl.Document.Title)
    pag.Sync
    
    hwnd(0)  = brow.getroproperty("hwnd")
    hwnd(1)  =  pag.getroproperty("hwnd")
    
    FunOpenBrowser = hwnd
    
End Function

I use a program to modify host files, because I have different test environments, but when i launch this function the opend browser has always the same host...
[if i write a similar function using SystemUtil.Run "iexplore" i have not this problem].
Can somebody explain me this behaviour?
thanx a lot
Reply
#2
Not Solved
what is the relation between the host files and the function you have given above?
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#3
Not Solved
Hi Ankur,
I modify host file before launching the function, for example if i suppose:
1. host file1 -> vodafone of AAA environment
host file2 -> vodafone of BBB environment

At the beginning i have host file1. I change with host file2, and then i launch my function: in my idea the function must open a browser towards www.vodafone.it related to BBB environment, but it opens AAA environment.

If i modify my function with another in which i use "systemutil run iexplore" i have not these problems (i modify host file, then i launch the function and the open browser is related to right environment), but i'd like to use my other function.

thanks to any help
Reply
#4
Not Solved
I still don't understand...can you explain the LOGICAL sequence? How are they related in terms of scripting?
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#5
Not Solved
They are not related... the change of host is a pre-requisite before launch of script to choose the right environment in which doing tests... but i observe that with the function "systemutil.run ..." the browser will be opened always on the right environment, while with CreateObject("InternetExplorer.Application") not...
In particular, if for example there is a browser already opened on AAA environment, then change host towards BBB and launch function, the new browser will be opened again on AAA (and not BBB...), while if there are not previous opened browsers on AAA, the new browser will be correctly opened on BBB.
It seems that in case of pre-existent opened browsers, the CreateObject("InternetExplorer.Application") will open a new browser on the same environment of opened browsers...
It's strange because with "systemutil.run ..." i have not this behaviour...
Reply
#6
Not Solved
ok you need to destroy the object and quit from IE in the end.
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply
#7
Not Solved
so without closing opened browsers is it not possible to open new browsers in other environments using objects, right?
thanks a lot
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Cannot find the "[ WebEdit ]" object's parent "[ Browser ]" (class Browser). Verify t Divya Roopa 1 8,460 03-11-2014, 12:13 PM
Last Post: devarapallliramana
  Sendkeys to close an open web browser prasadworld321 2 8,457 03-05-2010, 12:23 PM
Last Post: prasadworld321
  Want to open a new browser window with new session umer830 1 8,071 01-18-2010, 04:45 PM
Last Post: satan
  Unable to open a file using open file dialog windows vista umer830 10 14,064 12-21-2009, 01:48 PM
Last Post: Saket
  Retreive Title for an Already Open Browser coasterdad1971 1 2,435 06-11-2008, 09:08 PM
Last Post: ramu

Forum Jump:


Users browsing this thread: 2 Guest(s)