#HTMLPosRetry
System variable - Web function
The #HTMLPosRetry system variable controls how many times the coordinates of an HTML element have to be the same before WinTask can use them. The default value is 0, which means that the coordinates rendered by IE are considered as the correct ones and no coordinates retry is done.
Usage
ClickHTMLElement and WriteHTML functions calculate the coordinates of the specified HTML element before clicking it or writing into it. On some web sites or very fast PCs, the element is first displayed at some coordinates and when all the page is loaded, the element is at a different place. By using #HTMLPosRetry with a default value not equal to 0, before using the element, the script checks that its coordinates rendered by IE are #HTMLPosRetry times the same. Be aware that it slows down script execution, so use this variable only when a web field is not typed correctly by WriteHTML.
Syntax
#HTMLPosRetry = 0
or
#HTMLPosRetry = nRemarks
If #HTMLPosRetry=0 (default value), at execution of a ClickHTMLElement or WriteHTML function, WinTask gets the coordinates of the HTML element specified by its HTML descriptor and uses them directly for clicking it or writing into it.
If #HTMLPosRetry=n (n integer different from 0), WinTask gets the coordinates of the HTML object, pause half a second, retrieves again the coordinates and checks that they are still the same. When they are #HTMLPosRetry times the same, the object is used by the script.
If after #ActionTimeout, the HTML element is not found (either the coordinates could not be retrieved, or it was not possible to get the same coordinates for #HTMLPosRetry+1 times), the error "HTML Element not found" is displayed (unless #IgnoreErrors=1)
Example
'Note the speed typing difference depending on #HTMLPosRetry value.
StartBrowser("IE", "www.wintask.com/demos")
UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")
#HTMLPosRetry=3
UsePage("Form")
'The typing in the Company field takes a while as it checks that the coordinates
'of the field are 3 times the same.
WriteHTML("INPUT TEXT[NAME= 'company']", "My Company")
pause 1
ClickHTMLElement("INPUT RESET[VALUE= 'Clear']")
#HTMLPosRetry=0
'The same typing is fast as it writes immediately as soon as the coordinates of the field are rendered by IE.
WriteHTML("INPUT TEXT[NAME= 'company']", "My Company")
pause 1
CloseBrowser()