Micro Focus QTP (UFT) Forums
Browser Activate - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Browser Activate (/Thread-Browser-Activate)



Browser Activate - ramesh.tahiliani - 09-10-2009

Hi

could anybdy let me know how to ativate the browser window/Page through the code.
(As we do for Window("Name").Activate)

Thanks
Ramesh


RE: Browser Activate - Saket - 09-10-2009

Its not required when you are using QTP to activate the browser before working on it. can you please explain the issue?
anyway you can do this using handle of the browser
Code:
hwnd=Browser("Login").GetROProperty("HWND")
Window("HWND:=" & hwnd).Activate
I doubt it will not work in QTP 9.2 and later


RE: Browser Activate - ramesh.tahiliani - 09-10-2009

Hi Activate,

I had some task of taking bitmaps for the objects but when i say the command to capture bitmap (browser("title:=Find a Flight: Mercury Tours:").page("title:=Find a Flight: Mercury Tours:").webtable("name:=Home").CaptureBitmap "C:\123.png",1 ) then at that time my focus was not on the Page (it was on QtP). So instead of taking the bitmap for webtable it was capturing somrthing else

Now I tried ur which worked fine for me

Code:
hwnd_FindFlight = browser("title:=Find a Flight: Mercury Tours:").page("title:=Find a Flight: Mercury Tours:").GetROProperty("hwnd")
Window("hwnd:="+cstr(hwnd_FindFlight)).Activate
browser("title:=Find a Flight: Mercury Tours:").page("title:=Find a Flight: Mercury Tours:").webtable("name:=Home").CaptureBitmap "C:\123.png",1

Thanks
Ramesh Tahiliani


RE: Browser Activate - Saket - 09-10-2009

OK... thats great man.
Activate??? Smile

Always wrap your code with proper tags to make your post much readable.


RE: Browser Activate - ramesh.tahiliani - 09-10-2009

I had some task of taking bitmaps for the objects but when i say the command to capture bitmap (browser("title:=Find a Flight: Mercury Tours:").page("title:=Find a Flight: Mercury Tours:").webtable("name:=Home").CaptureBitmap "C:\123.png",1 ) then at that time my focus was not on the Page (it was on QtP). So instead of taking the bitmap for webtable it was capturing somrthing else

Now when I tried ur code and it worked fine for me

Code:
hwnd_FindFlight = browser("title:=Find a Flight: Mercury Tours:").page("title:=Find a Flight: Mercury Tours:").GetROProperty("hwnd")
Window("hwnd:="+cstr(hwnd_FindFlight)).Activate
browser("title:=Find a Flight: Mercury Tours:").page("title:=Find a Flight: Mercury Tours:").webtable("name:=Home").CaptureBitmap "C:\123.png",1

Thanks
Ramesh Tahiliani


sorry by mistake i wrote Activate instead of your name