Clicking on elements and associating tabs
Develop a script to navigate two web pages, associate tabs, and manipulate elements, such as assigning values to fields and obtaining values from a field.
Before you begin
To develop the script, you need:
- IBM RPA Studio 20.12.0 or higher
- One of the supported browsers:
- Google Chrome
- Mozilla Firefox
- Internet Explorer
- Microsoft Edge
- Stable internet connection
- Use the Designer tab in IBM RPA Studio
You can search commands in IBM RPA Studio's toolbox using the command's label or its verb.
Procedure
Starting the browser
You need to create a new instance of the browser to navigate to an web page:
- In the Home tab, click the New variable button to define a new variable.
- In the Name input parameter, insert the value
instanceName
. - In the Variable Type input parameter, select the
Text
option. - In the Value input parameter, insert the value
browser-instance
. - Insert the Start Browser command into the script.
- In the Instance name input parameter, insert the variable
${instanceName}
. - In the Browser Type input parameter, select a browser available on your machine.
The Close Browser command closes the web automation scope. It is automatically inserted into the script when saving the Start Browser command definition.
- In the Close Browser command, insert the values:
- In the Instance name input parameter, insert the variable
${instanceName}
. - Toggle the Keep browser open input parameter on.
- In the Instance name input parameter, insert the variable
Manipulation of elements
Click the Try it yourself button in the Input Type Text topic. A new tab in the browser opens for you to associate the new tab context with the current browsing context:
- Insert the Wait for Webpage Requests command in the script.
- In the Timeout input parameter, insert the value
00:00:30
. - Insert the Click on Web Page command in the script.
- In the Search for input parameter, select the
Css
option. - In the CSS input parameter, insert the value
#main > div: nth-child (14) > a
. - In the Timeout input parameter, insert the value
00:01:00
. - Insert the Find or Attach Tab command into the script.
- In the Timeout input parameter, insert the value
00:00:30
.
Setting value to the fields
Use the Set Value to Field command to assign values to fields:
- Insert the Set Value to Field command in the script.
- In the Value input parameter, insert the value
Your first name
. - In the Selector Type input parameter, select the
Id
option. - In the ID input parameter, insert the value
fname
. - In the Timeout input parameter, insert the value
00:00:30
.
- In the Value input parameter, insert the value
- Insert the Set Value to Field command again in the script.
- In the Value input parameter, insert the value
Your last name
. - In the Selector Type input parameter, select the
Id
option. - In the ID input parameter, insert the value
lname
. - In the Timeout input parameter, insert the value
00:00:30
.
- In the Value input parameter, insert the value
Use the Click on Web Page command again to click on the Submit button of the form.
- Insert the Click on Web Page command in the script.
- In the Search for input parameter, select the
Css
option. - In the CSS input parameter, insert the value
body > form> input [type=submit]:nth-child (10)
. - In the Timeout input parameter, insert the value
00:01:00
.
- In the Search for input parameter, select the
Getting values
Use the Get Element Value command to get the value of the user input field in the form:
- Insert the Get Element Value command into the script.
- In the Selector type input parameter, select the
Css
option. - In the CSS element input parameter, insert the value
body > div.w3-container.w3-large.w3 -border
. - In the Timeout input parameter, insert the value
00:00:30
. - In the Value output parameter, insert the value
valueObtained
.
What to do next
Run the script by clicking the Start button on IBM RPA Studio's Home tab.