Set

Sets the value of an entry field.
Use this to set the value of an input field, a password field or a text area. This commands also supports the file input field (for file upload).

Parameters

wpath
The WPath identifying the control (see WPath for a detailed description).
Input Field, Password Field, Text Area, File Upload
The path is usually the label of the field.
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command sets the value of the first element after all these words.
value
The new value to set.
Input Field, Password Field, Text Area
The new value for the field. Leave this empty to clean the field.
File Upload
The file name (relativ to the location of the test source file).

Examples

Set the value of an input field

Set the value of an input field labeled 'Your profession' to 'WebApp Tester'.

Command Parameter Optional Parameter
set Your profession Wetator

You can also clear the input field labeled 'Your profession'.

Command Parameter Optional Parameter
set Your profession

Set the value of a file upload control

Set the value of a file upload control labeld 'Upload your resume' to 'my_resume.pdf'.
File 'my_resume.pdf' is in the same directory folder as the test script.

Command Parameter Optional Parameter
set Upload your resume my_resume.pdf
click-on Submit
assert-content Wow! What an impressive resume.

With modern browsers the entry field for the file name is no longer visible. The set command works the same way.

Command Parameter Optional Parameter
set Please find attached my resume my_resume.pdf
click-on Submit
assert-content Wow! What an impressive resume.

More sophisticated control libraries (like PrimeFaces) are adding a lot more decoration to the file upload control. But the usage from your Wetator test is still the same.

Command Parameter Optional Parameter
set Choose upload.png
click-on Upload
assert-content Thanks for the nice picture.