Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Open Browser
#1
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
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
Reply
#4
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
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
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
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 9,145 03-11-2014, 12:13 PM
Last Post: devarapallliramana
  Sendkeys to close an open web browser prasadworld321 2 9,050 03-05-2010, 12:23 PM
Last Post: prasadworld321
  Want to open a new browser window with new session umer830 1 8,481 01-18-2010, 04:45 PM
Last Post: satan
  Unable to open a file using open file dialog windows vista umer830 10 15,867 12-21-2009, 01:48 PM
Last Post: Saket
  Retreive Title for an Already Open Browser coasterdad1971 1 2,798 06-11-2008, 09:08 PM
Last Post: ramu

Forum Jump:


Users browsing this thread: 1 Guest(s)