Getting StartedIntroductionGetting startedOverviewRunning TestoTests running policy
Testo for Hyper-V GuidesGuide 1. The very first testGuide 2. Ubuntu Server InstallationGuide 3. Internet access in virtual machinesGuide 4. Guest AdditionsGuide 5. ParamsGuide 6. CachingGuide 7. Linking up virtual machinesЧасть 8. Flash drivesGuide 9. MacrosGuide 10. If clauseGuide 11. No snapshotsGuide 12. Mouse controlGuide 13. Importing disk imagesGuide 14. JS-selectorsGuide 15. Cycles
Testo for QEMU GuidesGuide 1. The very first testGuide 2. Ubuntu Server InstallationGuide 3. Guest AdditionsGuide 4. ParamsGuide 5. CachingGuide 6. Internet access in virtual machinesGuide 7. Linking up virtual machinesGuide 8. Flash DrivesGuide 9. MacrosGuide 10. If clauseGuide 11. No snapshotsGuide 12. Mouse controlGuide 13. Importing disk imagesGuide 14. JS-selectorsGuide 15. CyclesGuide 16. Macros with declarations
ReferenceTest scripts general overviewTesto lang basic syntaxVirtual Machine declarationVirtual flash drive declarationVirtual network declarationParamsTests declarationMacrosVirtual Machines ActionsMouse actionsDetecting images on the screenVirtual Flash Drives ActionsConditionsCyclesPossible keyboard key IDs
JS-selectors come in handy when you want to perform an especially tricky mouse move action or to wait a really complex event to appear on the screen. Basically JS-selectors let you extend default Testo-lang possibilities and write your own screen-searching logic, no matter how elaborate.
- To specifiy a complex screen event for a
waitaction and a
- To specify a complex place to move the mouse cursor for the
JS-selectors start with a keyword
If a JS-selector is placed inside a one-line string, all the double quotes in the selector must be escaped with the
\character. If the selector is placed in a multiline string, there's no need to escape double quotes.
There are some differences between snippets used for the
check) and for the
true means that the specified event is found on the screen and the waiting (checking) must be finished. A wait with JS-selector returned a
true finishes successfully and a
check expression returns
false means that the event hasn't happened on the screen yet and the searching must continue. A wait or a check with a JS-selector, which returned
false, sleeps for the
time_interval specified for them. After that it tries to process the JS-selector one more time with another screenshot.
timeout time interval is exceeded, a wait action generates an error and the test fails. A check expression returns
false in the same situation.
When used in the
mouse actions, JS-selectors must return a Point: an object (of any class, it doesn't matter) with the
y properties with numbers as their values.
Returning a point means that the JS-selector found the destination to move the cursor to. So the
mouse action finishes waiting and moves the cursor to the returned point.
If the JS-selector is not ready to return a point (the expected event hasn't happend on the screen yet) it should throw
ContinueError, which will force the
mouse action to sleep a little bit and try to process the JS-selector one more time with another screenshot.
mouse action contains a JS-selector with
ContinueError exceptions and the processing time of this selector exceeds the
mouse action timeout (1 minute by default), then a timeout error will be generated.