Object not visible error? (341 Views)
Reply
Advisor
RicoLee
Posts: 35
Registered: ‎05-09-2013
Message 1 of 5 (341 Views)
Accepted Solution

Object not visible error?

Hi all, I have a function that can highlight and bring the browser window to the front, but every time I runs it the test result will show failed and states that the object is not visible, while the browser did brought to the front and the Test were not interrupted. Any idea how to work around it, like make the failed message ignored for particular function?

 

Below is the code I used:

Function BrowserActivate(Object)
    Dim hWnd
 
    hWnd = Object.GetROProperty("hwnd")
 
    On Error Resume Next
        Window("hwnd:=" & hWnd).Activate
 
        If Err.Number <> 0 Then
            Window("hwnd:=" & Browser("hwnd:=" & hWnd).Object.hWnd).Activate
            Err.Clear
        End If
    On Error Goto 0
End Function
 

 

Browser("Main Page").Activate  

 

.-asd-.
Advisor
Deepak111
Posts: 22
Registered: ‎02-15-2013
Message 2 of 5 (325 Views)

Re: Object not visible error?

I am not exactly sure what you need but if it is about ignoring the failure and NOT display that in the result, you can use the below code before the statement where it shows failure:

 

Reporter.Filter = rfDisableAll

 

Be aware that this will completely disable any logging in the result file. To enable the logging back, you should use

 

Reporter.Filter = rfEnableAll

 

So, I guess in your case you need to use the first statement before the line where the failure is shown and use the second statement immediately afterwards.

Regular Advisor
Umang_Agrawal
Posts: 83
Registered: ‎04-30-2008
Message 3 of 5 (323 Views)

Re: Object not visible error?

Do line by line debugging by catching the value of err.number in the debug viewer. Identify the line in which you get this error. There may be a chance of sync issues.


Deepak111 wrote:

I am not exactly sure what you need but if it is about ignoring the failure and NOT display that in the result, you can use the below code before the statement where it shows failure:

 

Reporter.Filter = rfDisableAll

 

Be aware that this will completely disable any logging in the result file. To enable the logging back, you should use

 

Reporter.Filter = rfEnableAll

 

So, I guess in your case you need to use the first statement before the line where the failure is shown and use the second statement immediately afterwards.


 

Umang Agrawal
Advisor
RicoLee
Posts: 35
Registered: ‎05-09-2013
Message 4 of 5 (318 Views)

Re: Object not visible error?

[ Edited ]

I've added


Browser("Main Page").Sync


before using the .Activate, it still have the error appearing, and when I use ObjectSpy the browser is in repository and it is appearing during test as well.
I will use the trick in first reply as work around for this, until there is better solution to fix the error message.
Thanks all.

.-asd-.
Frequent Advisor
GeorgeCC
Posts: 104
Registered: ‎02-08-2012
Message 5 of 5 (300 Views)

Re: Object not visible error?

This will work, though finding the root cause of your problem should be your first avenue.

 

But I used the "turn off logging" technique in places where an object may or may not be present and the .EXISTS doesn't work.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.