Set Value to Field
Verb: webSet
Sets a value to a field located in a web application, according to the value of its selector.
Syntax
webSet --value(String) --selector(WebFieldElementSelectors) --id(String) --name(String) --css(String) --xpath(String) [--simulatehuman(Boolean)] [--timeout(TimeSpan)] (Boolean)=value
Inputs
| Script | Designer | Required | AcceptedTypes | Description |
|---|---|---|---|---|
| --value | Value | Required | Text | Value that should be set to the field. |
| --selector | Selector Type | Required | WebFieldElementSelectors | Type of web element selector:
|
| --id | Id | Only whenSelector Type is Id, IdAndName | Text | Desired field Id. |
| --name | Field Name | Only whenSelector Type is Name, IdAndName | Text | Name assigned to the field. |
| --css | Css | Only whenSelector Type is CssSelector | Text | CSS selector for the desired field. |
| --xpath | XPath | Only whenSelector Type is XPath | Text | XML path leading to desired the field. |
| --simulatehuman | Simulate Human | Optional | Boolean | Simulates the interaction of a human user by moving the mouse cursor to the center of the element and clicking it.
In the case of filling in a field with a certain value, instead of entering the entire value, the bot simulates a user by typing. |
| --timeout | Timeout | Optional | Time Span, Number, Text | Maximum wait time for command execution.
In case no value is defined for the timeout parameter, the execution uses the context timeout defined by the Set Timeout command. If that command is not used on the script, the default timeout is 5 seconds. |
Outputs
| Script | Designer | AcceptedTypes | Description |
|---|---|---|---|
| value | Success | Boolean | Returns "True", if the field value has been succesfully set, or "False" if otherwise. |
Example
The browser starts, then navigates to the Google page. The Set Value to Field command sets the value "IBM Robotic Process Automation" to the search field.
webStart --name browser --type "Chrome"
webNavigate --url "www.google.com"
webSet --value "IBM Robotic Process Automation" --selector "Name" --name q
// The command uses the element name to find the field where the value should be set.
webClose --name browser --leavebrowseropen
// Keep the browser open.