[Precondition]

[Steps]

1. Perform click “+”, “1”, “=”.

2. Repeat step 1 four times.

 [Expected]

2. Output = 5 -> End of loop.

The while command will work as depicted above

Create Test precondition

Open website: https://www.calculator.net/

  • Click button “Record script”    to start making “record” at the website.
  • Enter the website link in the text box “Base URL” and Click button “Start Recording”.

Create steps for script

  • When the URL link is opened, the tool will automatically generate the default steps: open and set window size.
  • Use “ Store text” command (Store the text element in a variable):  click button to select the target on the recording screen and set the value to “OutPut”.
  • Use “While”  command to execute the same set of statements over and over until the while condition becomes false. Here we will set the target output < 5 condition.
  • Code inside while block -> perform click action “+”, “1”, “=”.
  • Continue to use the “Store text”command to confirm the output value has been changed. Then select the “end” command to end the While statement.

Run Test script

  • Click “Stop Recording” button and do “Run current Test”.

➩ Test script was created and run successfully:

Here concludes the practical demonstration of while command in Studio Web.

Leave a Reply

Your email address will not be published. Required fields are marked *