WriteHTMLPaste

Web function.

The WriteHTMLPaste function writes text in a Web form by pasting the specified text

Usage

WriteHTML function cannot send special characters such as a < used in HTML tags. WriteHTMLPaste can then be used to paste all the specified text "as is" in the web field. With the delete optional keyword, the content of the field can be deleted before pasting.

Syntax

ret=WriteHTMLPaste(<html_descriptor>,<text> [,delete])

Parameters

<html_descriptor>, unique identifier for the HTML object where to write within the current Web page specified by the last UsePage. See HTML descriptor for HTML tags identification. Use Recording mode for generating automatically the <html_descriptor>.

<text>, string, text to be typed in the form field. The <text> is pasted "as is". It is pasted at the end of any existing text already displayed in the field. if delete keyword is used, the content of the field is deleted before pasting the <text>.

Delete : optional keyword. If Delete is specified, any text in the form field is deleted before pasting the <text>.

Return value

Ret, numeric return code. The function tries to find the HTML object for 30 seconds (this default value can be changed using #ActionTimeout), and then types the text. If the object has been found, the function returns 0. Otherwise use this return code for Error Handling.

List of negative error codes

-1

No browser in use (no previous UsePage or StartBrowser)

-3

Bad descriptor, invalid syntax

-4

The browser has been lost (for instance because of a Closewindow)

-5

Page not found

-8

Specified element not found

-11

Any other error

-404,405

Usual http error codes (requires IE 6 or above)

Remarks

If at replay, the <text> is not correctly input, slow down using #HTMLPosRetry

See also

#HTMLPosRetry
WriteHTML

Examples

On the demonstration WinTask Web site, we click the Form link and then we fill the form. The Pause lines are added to demonstrate how WriteHTMLPaste works.

StartBrowser("IE", "www.wintask.com/demos",3)

UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")

UsePage("Form")

WriteHTML("INPUT TEXT[NAME= 'company']", "My Company")

pause 1
WriteHTMLPaste("INPUT TEXT[NAME= 'company']", "My Other Company")

pause 1
WriteHTMLPaste("INPUT TEXT[NAME= 'company']", "My Company",delete)

 

ClickHTMLElement("INPUT RESET[VALUE= 'Clear']")

CloseBrowser()

 

On the demonstration WinTask Web site launched using Firefox, we click the Form link and then we fill the form. The Pause lines are added to demonstrate how WriteHTMLPaste works.

StartBrowser("FF", "www.wintask.com/demos",3)

UsePage("WinTask Demonstration Pages")
ClickHTMLElement("A[INNERTEXT= 'Form']")

UsePage("Form")

WriteHTML("INPUT TEXT[NAME= 'company']", "My Company")

pause 1
WriteHTMLPaste("INPUT TEXT[NAME= 'company']", "My Other Company")

pause 1
WriteHTMLPaste("INPUT TEXT[NAME= 'company']", "My Company",delete)

 

ClickHTMLElement("INPUT RESET[VALUE= 'Clear']")

CloseBrowser()