Set Timeout
Verb: setTimeout
Available from: <Standard>
Sets a default timeout for all commands in the script that have a timeout parameter.
Syntax
setTimeout --timeout(TimeSpan)
Inputs
Script | Designer | Required | AcceptedTypes | Description |
---|---|---|---|---|
--timeout | Timeout | Required | Time Span | Default timeout to be used in the script. |
Example
The Start Browser command starts the browser, the Navigate command accesses the website "https://www.ibm.com", the Wait for Element in a Web Page command waits for the logo element with the default time ( 00:00:05) if the element is not found, the Set Timeout command is used to change the default timeout to 30 seconds.
defVar --name IBMLogo --type Boolean
defVar --name IBMLogoUpdatedTimeout --type Boolean
webStart --name browser --type "Chrome"
webNavigate --url "https://www.ibm.com"
webWaitElement --selector "Id" --id logo IBMLogo=value
if --left "${IBMLogo}" --operator "Is_True" --negate
setTimeout --timeout 00:00:30
webWaitElement --selector "Id" --id logo IBMLogoUpdatedTimeout=value
assert --message "Could not load page" --left "${IBMLogoUpdatedTimeout}" --operator "Is_True"
endIf
logMessage --message "Found on first timeout: ${IBMLogo}\r\nFound on updated timeout: ${IBMLogoUpdatedTimeout}" --type "Info"
webClose --name browser --leavebrowseropen
Remarks
If there is a time set directly to the timeout parameter of a command, Set Timeout does not alter it.