Skip to main content

I am automating a web application, I have multiple rows in a table I want to capture specific element from the row when the value in the second column of the row of table matches with the id. id is stored in a variable.

Note: sometimes there are multiple users displayed in search so we want to select specific user. as shown in picture below.

 

Hi @farrukh 3229 ,

What you can do is first capture the data table → Then loop it using for each row in data table→ and using If condition you can check the ID stored in variable and data stored in the second column.

Let me know if the solution works.


@farrukh 3229 user html value or innerhtml value and check the condition with specific user and use dom path index for the column 


Hi @Zaid Chougle Thanks for the response.

There is a issue that when we use loop for each row in table the current row is assigned to record variable and when i use if condition to check id using string condition the record variable cannot be matched with string please guide on this.


hi @rbkadiyam Thanks for the response.

can you please ellaborate more.


@farrukh 3229 

when capturing first & second rows in data table, copy the html properties and provide here.. will tell you where you need to place variable in order to loop all rows in data table and what html tag needs to check for the condition 


Hi @Zaid Chougle Thanks for the response.

There is a issue that when we use loop for each row in table the current row is assigned to record variable and when i use if condition to check id using string condition the record variable cannot be matched with string please guide on this.

Hi @farrukh 3229 ,

Sorry for the delayed response,

There might be a space in front or back in the Id getting extracted from the row. Can you please first use the trim action inside string package for the record variable → assign it to another variable and then check the If condition.

Let me know whether the solution works or not.


Hi @Zaid Chougle 

Hope you are doing well. I am almost done, but there is issue in capturing button based on loop search as i have applied loop on user Id but when we search sometimes there are multiple elements appeared based on that search so how can x path be dynamic or any other solution that i can select a specific button from the table rows where my user id is matching as buttons x path are same only id is changing on every search so i am not able to capture that specific element from the list. kindly guide. 


Hi @Zaid Chougle 

Hope you are doing well. I am almost done, but there is issue in capturing button based on loop search as i have applied loop on user Id but when we search sometimes there are multiple elements appeared based on that search so how can x path be dynamic or any other solution that i can select a specific button from the table rows where my user id is matching as buttons x path are same only id is changing on every search so i am not able to capture that specific element from the list. kindly guide. 

Hi @farrukh 3229 ,

 

I believe that you have to click on the reset password button present at the end of the table if condition matches for the ID. In that case follow below steps : 

  • Use the recorder to capture the properties of that button.
  • Make the DOMX Path dynamic. Manually check the XPath, extract the XPath of first two buttons(manually by doing inspect element in google chrome → copy full XPath)  and check which part is changing(incrementing) and pass a variable into that. Say for example there is a tr in the XPath which is starting from 1 (tr 1])and incrementing as the iteration goes forward. So what you can do is create a variable named Counter(type string) pass the default value as 1 and pass that variable in the tr(ex : tr $Counter$]. 
  • At the end of the iteration convert the variable to→ number type → increment by 1→ convert it again to string and assign it to the same variable which is passed in the XPath.
  • Place the click button inside the condition of ID match

@Zaid Chougle 

Thanks for the support.


@farrukh 3229 , happy to help.


Reply