Dynamic change in element

How to handle a dynamically changed webpage?

There are webpages where the elements are changed dynamically. In such scenarios, the chances
of “Element not found on the browser” error is thrown. This can be handled by providing a variable
in the Robility spy window. Below are the steps on how to handle this scenario.



 

Let’s see an example which will help you to understand how we can use the variable in the attribute
window. Here we extract the name and position of a person from the following webpage
https://datatables.net/

Steps to execute the workflow

1.      Drag and drop a “While” activity to the workflow.

a.      Declare the variable “Counter” in the variable section with the variable type “Int32”.
 

b.      Give the condition as “Counter<10” as we will need the first 10 rows from the table.

c.      The purpose of utilizing a counter is to increment the values for the "While" activity.
To achieve this, include an "Assign" activity. Before that, declare a variable named
"Counter" and select the data type as "Int32." The reason for choosing the integer data
type is that we are incrementing the value.

d.      Drag and drop an “Assign” activity and assign a value for “Counter” as “Counter +1”,
as the activity will run in a loop, and we want to extract the data from the next to next
row each time.

 

2.      Now for the bot to extract the data right each time, we have to assign a variable to the “tableRow”
attribute in the Robility spy window.


 

 

Here we are going to assign the variable “rowCounter” to “counter.Tostring” (Convert from integer to
string) which can be declared in the robility spy section.

 

3.      Now let’s continue the workflow.

4.      Drag and drop a “Get text” activity and spy the first name from the name column of the webpage.

a.      Store the extracted text in the variable GetText1.

b.      Now navigate to the Robility spy section of the “GetText” activity and enter the variable
“rowCounter” in the tableRow attribute.

c.      This will help to extract each name from table till it reaches the count 10 based on the
 condition given in the while activity.

5.      Drag and drop a “Writeline” activity below this. Give the input in the text box as
"Row Position: " + rowCounter+ " Column  Name: Name: Value is: "+ GetText1

6.      Drag and drop another “GetText” activity and spy the first position from the position column of the
webpage.

a.      Store the extracted text in the variable “GetText2.”

b.      Now navigate to the Robility spy section of the “GetText” activity and enter the
 variable “rowCounter” in the tableRow attribute.

c.      This will help to extract each position from table till it reaches the count 10 based on
the condition given in the “While” activity.

 



7.      Drag and drop a “Writeline” activity below this. Give the input in the text box as
"Row Position  : " + rowCounter+ " Column  Name: Name: Value is: "+ GetText2

8.      Execute the workflow to see the extracted values in the output box.

The bot executes the workflow, uses the “rowCounter” variable assigned in the attribute

editor section and extracts the name and position from each row and displays in the output

box.