Highlighted
AdrianCumpanasu Absent Member.
Absent Member.
1004 views

Workbench:VerifyAsset works only for True?

From documentation:

Executes a verification asset. Throws an ObjectNotFoundException if the UI object to verify cannot be found.
result = Verification.VerifyAsset(verificationAsset)

My question:

Is there some possible usage of this method or another method that could stop the script and display a desired message in the error window?

This seems to be useful only for the True case as for the false the playback crashes with an error popup, not being able to use the False boolean in any way.

0 Likes
1 Reply
Micro Focus Expert
Micro Focus Expert

RE: Workbench:VerifyAsset works only for True?

Hi Adrian

You can use a Try Catch statement and using MessageBox display a dialog which would stop the script until action is taken:

Dim result As Boolean

Try

result = Workbench.VerifyAsset("GMO Logo")

MsgBox("Image Verification Passed")

Catch

MsgBox("Image Verification Failed")

End Try

If (result = True)

.DomElement("//a[@id='storeBtn']").DomClick()

Else

.DomElement("//img[@id='showCart']").DomClick()

End If

You will also need to go into Options > Playback > General > Set "Catch Exceptions when thrown" to NO. The above example will perform a Try Catch to verify the asset on screen. If not found it will be caught in catch statement and MsgBox stating it wasn't found will display. Otherwise, if found, result = true, it will display msgbox stating it was found, and after try catch ends, it will use the result value to determine how to proceed. 

Regards,

Colin

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.