Locators rely on the current object, which is the object for which the locator is specified. The current object is located in the object hierarchy of the application's UI. All locators depend on the position of the current object in this hierarchy, much like a file system.
XPath expressions rely on the current context, which is the position of the object in the hierarchy on which the Find method was invoked. All XPath expressions depend on this position, much like a file system.
The object type in a locator for an HTML element is either the HTML tag name or the class name that Silk4J uses for this object. For example, the locators //a and //DomLink, where DomLink is the name for hyperlinks in Silk4J, are equivalent. For all non-HTML based technologies only the Silk4J class name can be used.
The following code sample identifies the first hyperlink in a browser. This example assumes that a variable with the name browserWindow exists in the script that refers to a running browser instance. Here the type is "a" and the current object is browserWindow.
DomLink link = browserWindow.<DomLink>find("//a");