How to handle dynamic elements in Dev Express Grid using Robot Framework?

I am testing a web application that is written using Angular and DevExpress controls. The grids used are DevEx and are dynamic. It does not appear possible to assign a static ID and I do not see a solution on DevExpress support. Does anyone have experience using these controls and Angular to provide some guidance?

In this small example, each column in the data grid has dynamically assigned values, which will also change with each additional row that is input.

Bullet items

  1. Is the referenced Seq 1 that sample input
  2. This is where data will be input for a new row
    3 & 4) I am highlighting the cell and Element that to show DOM structure

It would be important to know which library you are using.

And what you want to achieve.

Do you use SeleniumLibrary or Robot Framework Browser? Or anything else?

What do you need to do with that table? It is an HTML table.

Hi Barry,

I’ve found with applications like this where all the id’s are system generated that you need to find something else on the page as a reference point and leverage that reference point.

I found a publicly available DevExpress table, so I’ll use this as a reference as you didn’t provide a link to your app, hopefully this is similar enough.


As you can see the data structure appears similar.

The first thing I notices is the data and column headings are in different tables

So you’ll want to know how to identify them, in this example Class “dx-datagrid-headers” for the heading row and “dx-datagrid-rowsview” for the data rows

So first you want to identify the column you need, in the example above if I want the “Last Name” column I could use an xpath like this //div[contains(@class, "dx-datagrid-headers")]//td[div[text()="Last Name"]] to give me the td (table data cell) that contains "Last Name), I can then get the aria-colindex attribute to get the column number

In your case, it looks like most of the column headings are missing, so you’ll probably want to get the “EXP” column, and then subtract a few (5?) and hopefully this will reliably get you the right column number, save this to a variable like ${inputcol}

Again you might also want the “Seq” column?

Next you need the row number, I gather the value “19744S” (1) in your screen shot is a value you already know? so to find it’s row number, I’ll use the example of finding the row number of the position “IT Manager” from the example table above

Using xpath //div[contains(@class, "dx-datagrid-headers")]//td[div[text()="Position"]] and the the aria-colindex attribute, I know the Position column is column 5
So then I can use xpath //div[contains(@class, "dx-datagrid-rowsview")]//tr[td[@aria-colindex=5 and text()="IT Manager"]] to get the tr (table row) that contains the text “IT Manager” in column 5, with this I can use the attribute aria-rowindex to get the row number, in your case I guess you’ll be finding the row that contains “19744S” in column 3?

Once you have that row number, you can subtract 1? to get the row you need to enter data into (2), save this calculate row number to something like ${inputrow}

Now it’s just a matter of constructin the xpath to your input field, something like //div[contains(@class, "dx-datagrid-rowsview")]//tr[@aria-rowindex=${inputrow}]/td[@aria-colindex=${inputcol}]/input I’d guess.

Hopefully that helps,

Dave.

I am mainly using Selenium Library with the goal to input data into the fields. @damies13 made some suggestions which I will try. Thank you.

1 Like

It is not robot it is about selenium locator.
Try something like the xpath : //table//tr[3]/td[@role=‘gridcell’ and @aria-describedby=‘dx-col-6’]
The dynamic parts are row number and column number.
you should have some keyword to construct the xpath using row and column like:
//table//tr[${row}]/td[@role=‘gridcell’ and @aria-describedby=‘dx-col-${col}’]
and use it to locate and interact with the element.

I am now having success in handling the locator using this strategy as suggested:
//div[contains(@class, “dx-datagrid-rowsview”)]//tr/td[@aria-colindex=3]

1 Like