Home > Language Reference > System Variables > HTMLPosRetry


The #HTMLPosRetry system variable controls how many times the coordinates of an HTML element have to be the same before WinTask x64 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.


ClickHTMLElement, WriteHTML, WriteHTMLPaste and WriteHTMLEncrypted 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 setting #HTMLPosRetry to a value different from 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.




<value>, integer, number of retries.


If #HTMLPosRetry=0 (default value), at execution of ClickHTMLElement, WriteHTML, WriteHTMLPaste or WriteHTMLEncrypted functions, WinTask x64 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 x64 gets the coordinates of the HTML element, pauses half a second, retrieves again the coordinates and checks that they are still the same. When they are #HTMLPosRetry times the same, the element 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), Error Handling mechanism is used.

The default value for #HTMLPosRetry is 0.


'At script execution, 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  'Change the default value of #HTMLPosRetry
'As the coordinates of the field must be 3 times the same, the WriteHTML function does not write the text immediately
WriteHTML("INPUT TEXT[NAME= 'company']", "My Company")
pause 1
ClickHTMLElement("INPUT RESET[VALUE= 'Clear']")

#HTMLPosRetry=0  'Come back to the default value of #HTMLPosRetry
'WriteHTML function writes the text as soon as the coordinates of the field are rendered by IE.
WriteHTML("INPUT TEXT[NAME= 'company']", "My Company")
pause 1