How to perform a double click on an image in Silk Test Classic

How to perform a double click on an image in Silk Test Classic

Currently in Silk Test Classic, you can only use basic data types when using Dynamic Invoke. With Silk4Net and Silk4J you can use more complex data types as they provide full Image Recognition support whereas Classic does not.

In Classic, only a subset of the Image Recognition methods are exposed and can be called.

If you wish to perform a double click using Image Recognition, you can use the below workaround. This will perform a single click against your saved image which will move the cursor on screen to that position.

Then using GetPosition() against the Cursor class, we can then use the x and y integer values in the DoubleClick() function.

The below example is tested against a sample on the W3Schools website.

[-] testcase ImageDoubleClick()
     [ ]
     [ ] String image = "D:\doubleclick.png"
     [ ]
     [-] if (WebBrowser.BrowserWindow.DynamicInvoke("ImageExistsFile", {image}))
          [ ]
          [ ] WebBrowser.BrowserWindow.DynamicInvoke("ImageClickFile", {image})
          [ ]
          [ ] POINT pCursor
          [ ] pCursor = Cursor.GetPosition()
          [ ]
          [ ] WebBrowser.DoubleClick(MB_LEFT, pCursor.x, pCursor.y)

DISCLAIMER:

Some content on Community Tips & Information pages is not officially supported by Micro Focus. Please refer to our Terms of Use for more detail.
Top Contributors
Version history
Revision #:
1 of 1
Last update:
‎2016-10-27 11:12
Updated by:
 
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.