Micro Focus QTP (UFT) Forums
Check an object existing on a Browser - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Check an object existing on a Browser (/Thread-Check-an-object-existing-on-a-Browser)



Check an object existing on a Browser - linhke - 02-24-2011

Hi all,

I check the object "btnNo" button existing by the code as:

Code:
rc = Browser("EmailReport").Page("Report").WebButton("btnNo").Exist(60)
or
   rc = Browser("EmailReport").Page("Report").WebButton("btnNo").WaitProperty("disabled", 0, 60000)

Sometimes rc = True and sometime rc = False, although this page loaded before 60s.
I can not understand this point. So can anybody help me on that?

Many thanks,
linhke


RE: Check an object existing on a Browser - rajeshwar - 02-25-2011

Hi linhke,
Verifying if every time child window is in focus while you are checking for the button existence might help.






RE: Check an object existing on a Browser - linhke - 02-28-2011

Hi Rajeshwar,

Could you tell me how to focus it?

Thanks,
linhke


RE: Check an object existing on a Browser - rajeshwar - 02-28-2011

Hi Linhke,

You need to capture Handle to the window and then activate the child window.

Sample Code:
Code:
shwnd= Browser("Buddy List").Object.HWND
Window("HWND:="&shwnd).Maximize
Window("HWND:="&shwnd).Activate



RE: Check an object existing on a Browser - linhke - 03-01-2011

Hi Rajeshwar,
I tried as:

Code:
shwnd= Browser("Cyber_2").Object.HWND
Window("HWND:="&shwnd).Activate
but QTP inform General run error at line (shwnd=Browser("Cyber_2").Object.HWND) Sad

linhke


RE: Check an object existing on a Browser - rajeshwar - 03-01-2011

Hi Linhke,

What is the error, Please share the error description.

Window("HWND:="&shwnd).Maximize statement is working ?

Another Way to Capture handle to window:
Code:
hWnd = Browser("browser_name").GetROProperty("hwnd")
   Window("hwnd:=" & hWnd).Maximize



RE: Check an object existing on a Browser - linhke - 03-02-2011

Hi Rajestwar,

Both of way is not worked. I got the Run Error when trying with these ones:
"The operation cannot be performed"

linhke


RE: Check an object existing on a Browser - linhke - 03-03-2011

Hi Rajeshwar,
My problem was solved. The root cause is from me. I forgot configure Object Identification for the browser to QTP identify the unique to the Creation Time.

Thanks for your support,
linhke



RE: Check an object existing on a Browser - rajeshwar - 03-03-2011

Great, Good to hear that issue is resolved.