开发者

SilkTest workbench Invalid Object Handle Exception?

开发者 https://www.devze.com 2023-04-04 19:53 出处:网络
I\'m trying silktest for the first time with an in house application. In one of the windows, I have a button that has two menu lists :

I'm trying silktest for the first time with an in house application. In one of the windows, I have a button that has two menu lists :

New (pushbutton) ---> Option1 (list menu ) + Option2
if option1 clicked ---> subOption1, subOption2?

All these options are specific to the current scenario and user.

When recording, silktest detects the "New" pushbutton but when playing back, it throws an error : the handle of the object is invalidated.

One of the possible solutions is to instantiate Object something like this:

dim开发者_如何学Python button as New Pushbutton  

but it throws an error: SilkTest.ntf.Pushbutton.Friend sub New (handle as silk test.ntf.ObjectHandle) is not accessible in this context because it is 'Friend'

Can someone help? Any suggestions??


The "Invalid Object Handle Exception" is thrown when you try to work with an object that is no longer valid, consider for example a dialog that is closed, and afterwards you try to do something with it, it will no longer work. Sometimes the scenario is not so obvious, but the underlying principle is the same.

Also, don't construct PushButtons, get them using the find method, this will make sure that they contain a valid object handle.

Dim myButton As PushButton = myDialog.Find("//PushButton[@caption='New']")
myButton.Select()


Try to ensure the focus is on the button you want to push. If using silk4j, try to setFocus() on this element or even on its parent element firstly.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号