Java Controller
abstract
Sahi's Controller allows you to interact with Sahi and easily experiment and debug on the browser.
This section explains using the Controller in Java mode, for writing scripts in Java instead of Sahi script (javascript)
Accessor Spy
Java Controller for Sahi Pro.
Identify Elements
To identify an element, press the CTRL key and hover over any elementModes available in Sahi Pro for recording or identification:
Browser:
This mode is always enabled in Sahi Pro. Uncheck the checkbox for recording or identification in Browser mode only.Windows:
Check the checkbox to enable recording or identification for Windows. Sahi Pro Desktop Add-on should be installed for this.Java Applet:
For recording or identification in Java Applet mode Sahi Pro Desktop Add-on should be installed.Java Web Start:
For recording or identification in Java Web Start mode Sahi Pro Desktop Add-on should be installed.
Accessor:
shows the Java accessor for that elementAlternatives:
shows all alternative accessors for that elementValue/Text:
shows the value of the current element. Mostly this is the input text or the visible text.Prefix:
Populates the prefix as needed when working with popup windows and multiple domains. Eg. on a popup window, this may be populated with_popup("New Window")
Mode:
shows mode of application for which element is recording or identifying (not present in Sahi Pro).
Action Buttons
These buttons perform various actions on the element and also show the generated script in the "Evaluate Expression" box. These are used to quickly work with elements during debugging/script generation.Click
clicks on the identified element. Invokes the.click()
API.Hilight
highlights the identified element (shows a red 1 pixel border briefly). Invokes the.highlight()
API.Set
sets the value in "Value:" field on the identified element. Invokes the.setValue("")
API.Hover
does a mouse over on the element. Invokes the.mouseOver()
API.Assert
assert the behaviour of the system is as expected or not.
Assertions
Assertions are used to verify that the behaviour of the system is as expected. To add assertions using Sahi Java controller,- CTRL-Hover on the element to identify it and then click on
Assert
button - A few possible assertions for that element will be populated in the
Evaluate Expression
box - Select mode for evaluate application of which it identified
- Click on Append button to append the assertions to the script.
Evaluate Expression
Evaluate Expression box is used to evaluate snippets of Sahi Java code. It helps while identifying elements or while debugging.Set mode for evaluate
Select appropriate application mode before evaluate the expression.Test →
Put a valid Sahi expression in the Evaluate Expression box and click on Test →. The result will be seen in the bottom box.Append
While recording, selecting and clicking onAppend
will append the steps to the currently recording script. This is mainly used for manually append any step from Evaluate Expression to the currently recording script.Highlight
Can be used on selected text to highlights the element (shows a red 1 pixel border briefly). Invokes the.highlight
API.Click
Can be used on selected text to click the element. Invokes the.click
API.
info
Note: Selecting some text and pressing "→" will only evaluate the selected text. User may evaluate more than one statement at a time.
Record a script
- Choose the type of application for recording or identification.
- Click on 'Record' button and perform desired actions on the web page.
- Click on 'Stop' button to stop recording.
- Then click on 'Recorded Steps' button and it will show all the recorded steps.
- 'Clear' button is used to clear all the recorded steps.