Solved

Capture specific element from data Table in AA360


Badge +2

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.

 

icon

Best answer by Zaid Chougle 4 April 2023, 07:36

View original

10 replies

Userlevel 4
Badge +10

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.

Userlevel 5
Badge +10

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

Badge +2

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.

Badge +2

hi @rbkadiyam Thanks for the response.

can you please ellaborate more.

Userlevel 5
Badge +10

@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 

Userlevel 4
Badge +10

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.

Badge +2

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. 

Userlevel 4
Badge +10

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
Badge +2

@Zaid Chougle 

Thanks for the support.

Userlevel 4
Badge +10

@farrukh 3229 , happy to help.

Reply