Oryon IDE
The Oryon IDE is a full blown groovy editor with additional functionality tailored specifically for Oryon such as:
- an object tree representing the current state of the Java application currently connected to (on the left side)
- a central code editor view, with a tabbed interface allowing to edit multiple scripts at once
- a console displaying the output script executions at the bottom
- step-compatible input and output controls at the top and bottom
Once a target application is running with the Oryon agent, you can start the IDE using the script startOryonIDE.bat
,
and connect to the target application as follows:
Recording a script
In order to record UI interactions, all you have to do (in the target application!) is to hover the mouse over the UI elements to interact with, press the F6 key on the keyboard, and pick the action to execute from the pop-up menu that will appear.
As a result, the chosen action will be executed, and at the same time, a corresponding line of code will be added to the currently active script in the IDE.
Another valuable feature is available through pressing the F7 key while hovering on a graphic element in the target application, which will automatically reveal the location or position of this element in the hierarchical object tree on the IDE side.
You can repeat this process until you’ve reached the end of your scenario. Make sure to save your script when you’re done! :-)
Replaying a script
In order to replay a script, load the file containing your script and press the “Play” button. Alternatively, you can choose to only execute a part of the script by selecting the respective code lines, and pressing the “Play” button.
Interacting with the object tree
In addition to the “hover + F6” approach on the target application side, you can interact directly with the component tree by clicking and right clicking on nodes of the tree shown in the Oryon IDE, and choosing from the same set of functions as you’ll find in the F6-based list.
Lookup mode
If you enable Lookup mode (by activating the sunglasses icon found at the botton left in the IDE), selecting nodes in the tree will cause the corresponding element to be visually highlighted in the target application (e.g. by blinking or showing a frame around it). This is particularly useful if you’re struggling to identify an element visually or if you want to examine the actual hierarchy of visual objects.
Scripting
Core API
The default language that Oryon scripts are generated in is groovy. This means that you can do anything that you would be able to do in the groovy programming language and thus, more generally, in Java. In addition to standard Groovy and JDK functionality, Oryon makes specific objects available to you through its own API. The following objects are especially useful:
- gui : the basic object providing most of the primitives needed for locating and interacting with graphic objects.
- input : a key-value map used to pass information which may vary from an execution to the next (typically, business information).
- output : a key-value map used to return information which is necessary for assessing the correctness of the execution.
The following screenshots illustrate the way the editor and console behave when using input and output functionality, and in the event of errors:
Module-specific APIs
Depending on the Oryon module your target application is using, different operations with varying semantics are available.
Product-specific modules (i.e., modules strongly coupled to a certain vendor or application, such as Syrius) are documented separately. Please contact us for further information.
Using XPath to locate elements
The way Oryon identifies UI components is through their position in the tree-based representation of the target application’s state, and by inspecting various properties of the nodes in that representation.
Oryon employs the standardized XPath syntax (concretely, XPath 1.0. The XPath specification, while originally developed for XML documents, actually lends itself very well to structurally similar object model trees like the ones that Java UI applications use.
As you record a scenario and add code lines to your script, you’ll see that Oryon automatically generates the corresponding XPaths.
Supported attributes
Generally, the attributes which are shown in the object tree can be used inside XPath expressions. This usually includes one or more of the following: visible, text, nativname; the actual attributes which are available depend on the element in question.
Deprecated syntax for attribute “text”
For reasons of backward-compatibility with old Oryon versions, we also support a special syntax (//Node[text="something"]
) for the
“text” attribute (only!). Please do not use this syntax anymore, as support for it will be removed in a future version. Instead, use
the standards-compliant syntax: //Node[@text="something"]
.
XPath validation
An interesting feature of Oryon is the ability to immediately validate XPath correctness by clicking on the XPath in the editor window. There are three possible outcomes:
- If the XPath matches exactly one node, it will be highlighted in green, and the corresponding node will be selected in the tree view.
- If the XPath does not match any node, it will be highlighted in a faint red, and no changes occur in the tree view.
- If the XPath matches more than one node, it will be highlighted in orange, and the first matching node will be selected in the tree view. In addition, at the bottom of the screen, you will see the total number of matched nodes, and you have two buttons to cycle through the matched nodes.
As this is best explained visually, here are screenshots of the different cases:
XPath: Unique match
XPath: No matches
XPath: Multiple matches