Other Verification Options

There are a few other verification options which depend on capabilities of the protocol used for automation. The RFB (VNC) protocol supports the following features: 

  • Screen update events are received from the server any time the desktop image changes. When one expects a window to open or refresh on the desktop, update events may be used for a quick test of desktop changes. This principle was often used in early product versions (up to VNCRobot 1.2) when image search was not supported. As various VNC servers may have different image update strategies, this way of verification is not much reliable and we list it just for completeness. 
  • Bell events are generated when the server rings a bell (beeps). Such events are typically generated by printing out the BELL character (ASCII 0x07) on the desktop. Some GUI components are also known to ring the bell. For example, a text field beeps when you press the Backspace key and there is no character to delete. 
  • Server side clipboard updates. They are emitted when the server clipboard gets updated with text, for example through Ctrl+C or Ctrl+X pressed on the desktop. 

Be aware that these events may or may not be supported by other protocols (clients). If you decide to migrate your test scripts to another protocol, make sure to verify what is supported and what not. 

All the three features may be exploited by the Waitfor command as follows. For more information on the behaviour and other parameters see the Waitfor command specification

  • Waitfor update waits for screen update of the specified size (extent). It allows to say something like "wait until XX% of the screen updates". The command by default waits for a single large update. As Windows VNC servers prefer to break larger updates into a number of smaller ones, it is recommended to use the command with the "cumulative" parameter set to "true". It is also recommended to set up a wait command with an appropriate time value after the update condition is met because some applications rather emit a longer sequence of updates where an empty window displays first and the content is delivered later on in a separate update event. The following example starts Internet Explorer on Windows XP and opens the Google web site.

    Press Windows+r wait=3s
    Typeline iexplore
    Waitfor update extent="90%" cumulative=true wait=5s
    Press Ctrl+O wait=3s
    Typeline google.com
    Waitfor update extent="80%" cumulative=true wait=5s

  • Waitfor bell suspends script execution until one or more bell events are received from the server or the specified timeout is reached. Except a few GUI cases this command has no use on Windows. It is however quite powerful on Linux/Unix where bell can be emitted from a command line through " echo -e '\007'".This allows to execute a console command and wait until it completes ( "<command>; echo -e '\007'") or even test whether it succeeds ( "<command> && echo -e '\007'"). A simple example of waiting for a file search result on Ubuntu Linux follows. 

    Typeline "find /lib -name dummy.txt; echo -e '\007'"
    Waitfor bell timeout="1m"
  • Waitfor clipboard waits for the server clipboard update. It may be used to verify that a text content was successfully copied on the desktop and transferred to the client. The text transfer itself doesn't require the Waitfor command and it happens automatically whenever the clipboard content on the server side changes. The text is then available in the script through the  _SERVER_CLIPBOARD_CONTENT variable. Be aware that various VNC servers may require additional configuration steps to make the clipboard transfer work. See the Release Notes document for details. The following example demonstrates clipboard transfer on GNOME text editor on Ubuntu Linux. 

    Type test wait=1s
    Press Ctrl+A
    Waitfor clipboard timeout=5s