Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Highlighted
cwBrendan Absent Member.
Absent Member.
2941 views

Silk4J equivalent to 4Test's Desktop object?

Jump to solution

Is there an equivalent in Silk4J to the Desktop object in 4Test? We have helper methods that return the absolute location of objects in reference to the desktop and would previously use Desktop.click() to interact with them. Sorry if this is a duplicate question, I feel like I've seen an answer or a similar question but can't find it.

0 Likes
1 Solution

Accepted Solutions
cwBrendan Absent Member.
Absent Member.

RE: Silk4J equivalent to 4Test's Desktop object?

Jump to solution

I just installed 16.0 on a test machine and it appears to have been added in that version. Thanks.

0 Likes
6 Replies
Micro Focus Contributor
Micro Focus Contributor

RE: Silk4J equivalent to 4Test's Desktop object?

Jump to solution

Do you mean

private Desktop desktop = new Desktop();

or are you looking for something else?

0 Likes
chongSilk2013 Absent Member.
Absent Member.

RE: Silk4J equivalent to 4Test's Desktop object?

Jump to solution

In silk4J,

import com.borland.silktest.jtf.Desktop  

When you use it,  do something like

desktop.<DomTextField> find("yourTestingApp.BrowserWindow.OK button").click();

Object map is/are automatically created when recording

- yourTestingApp with the locator path, ie. //BrowserApplication

- BrowserWindow    with the locator path, ie. //BrowserWindow

- OK button   with the locator path, ie. //BUTTON[caption='OK']

You could also manually add more or modify them

0 Likes
cwBrendan Absent Member.
Absent Member.

RE: Silk4J equivalent to 4Test's Desktop object?

Jump to solution

When using SilkTest Classic with the 4Test language there is the DesktopWin class which represents the entire screen and has the predefined object called Desktop. You can use it to interact with the desktop outside of any application e.g. Desktop.Click() or Desktop.GetActive()

We are testing a custom application that has some hidden features that allow us to get the co-ordinates of objects in the application. The co-ordinates are in reference to the screen so we used Desktop.Click() instead of ourApplication.click().

Is there an equivalent of this object in Silk4J?

We have tried desktop.find("/Control[@caption='Program Manager']") but that doesn't appear to be consistent across different machines and Operating Systems. We can look into figuring out the differences but before putting in that work I want to confirm that some doesn't already exist built-in to Silk4J.

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Silk4J equivalent to 4Test's Desktop object?

Jump to solution

Hi cwBrendan,

You can use desktop.click() in Silk4J for clicking on absolute screen coordinates. However, the is no equivalent to the 4Test method Desktop.GetActive() in Silk4J.

Here is an example for clicking:

import com.borland.com.silktest.jtf.*;

public class Sample {

  private Desktop desktop = new Desktop();

  @Test
  public void clickSample() {
    desktop.click(MouseButton.Left, new Point(100, 500));
  }

}

The click method for the Silk4J Desktop class was added in one of the last few Silk4J versions (can't recall offhand which exact version it was). 

Michael

0 Likes
cwBrendan Absent Member.
Absent Member.

RE: Silk4J equivalent to 4Test's Desktop object?

Jump to solution

I am using SilkTest 15.5 Hotfix 5 and there is no click() method in the Desktop class. Was it added in the recently released 16.0?

0 Likes
cwBrendan Absent Member.
Absent Member.

RE: Silk4J equivalent to 4Test's Desktop object?

Jump to solution

I just installed 16.0 on a test machine and it appears to have been added in that version. Thanks.

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.