EyeAutomate provides a Java API for building powerful test scripts and automation tools. The API documentation is located in the javadoc folder.
To get started, ensure that EyeAutomate.jar is added to your project’s build path.
Java API Example:
public class TestExample
{
public void RunTestExample()
{
ScriptRunner scriptRunner=new ScriptRunner(null);
scriptRunner.runScript("Click", "Click \"images/button.png\"", null);
}
}
Custom Commands
Extend the capabilities of EyeAutomate by creating new commands using Java.
EyeAutomate loads and launches Java classes dynamically. All commands are stored in the “custom” folder. Both the compiled class file and the corresponding source code are provided.
Modify the source code or create your own, and place the compiled class into the “custom” folder. EyeAutomate will load all the classes in the “custom” folder (and subfolders) at startup.
Creating a Custom Command
A custom Java class must contain the executeCommand method:
A Java command that belongs to the “custom” package and is placed in the “custom” folder will automatically appear in the list of available commands in EyeAutomate.
Java libraries (JAR files) located in the “custom” folder are automatically loaded by EyeAutomate at runtime.
A custom Java class may contain a getHelp method that should return an HTTP address for context help for the command:
Specify the parameters that the custom class might create or modify using the getParameters method. This will prevent EyeAutomate from asking for the value of undefined parameters. This method should return a String array of parameters:
The getCommand method can be used to request information from the user before adding the command to the script. The getCommand method should return the text to be added to the script.
The tag "" will be replaced by EyeAutomate with the path of a captured image:
The tag "" will be replaced with a string:
The string may have a default value:
A string can include a number of options to select from:
The setScriptRunner method can be used to receive a reference to the ScriptRunner currently used. Use the ScriptRunner to perform API methods.
The getTooltip method can return a tooltip displayed in EyeAutomate.
Selenium Custom Commands
Selenium commands are stored in the “custom/selenium” folder and are automatically loaded when EyeAutomate starts.
A Selenium command is just like any other custom command. See the Custom Command section for instructions. Add or modify the classes in the “custom/selenium” folder, and restart EyeAutomate when done.
A Selenium command may get and set the currently used WebDriver using the methods:
Custom Command Examples
Study the commands in the “custom” folder. All EyeAutomate commands are provided with Java source code.