How to insert data in WPF data grid whose row's xpath is changing

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
PriyankaGokave
Posts: 1
Joined: Tue Apr 11, 2023 12:05 pm

How to insert data in WPF data grid whose row's xpath is changing

Post by PriyankaGokave » Tue Apr 11, 2023 4:19 pm

Hi,

I need to insert data in the a table. When try to do a data-driven approach using csv, all the values are inserted in the single cell i.e. 1st column 1st row. Instead I need to insert data in 1st row, 2nd row, 3rd row and so on..

Below are the repository items which are identified for each row when I tried the record and playback. Instead of having to capture multiple elements to insert data in multiple rows, I need a simple way. Is there a way to achieve this using user code? (I am new to Ranorex)
container/element[2]/container[@caption='']/container[@automationid='PART_LayoutPanel']/row//text[@automationid='NameAID']
container/element[3]/container[@caption='']/container[@automationid='PART_LayoutPanel']/row//text[@automationid='NameAID']
container/element[4]/container[@caption='']/container[@automationid='PART_LayoutPanel']/row//text[@automationid='NameAID']

IvanF
Posts: 151
Joined: Thu Aug 11, 2022 8:55 pm

Re: How to insert data in WPF data grid whose row's xpath is changing

Post by IvanF » Tue Apr 11, 2023 9:25 pm

Hi, you could consider parameterizing the element path itself and including those variables in the csv:

container/element[$rowid]/container[@caption='']/container[@automationid='PART_LayoutPanel']/row//text[@automationid='NameAID']

Not sure where the column is defined, but a similar approach could work, so you keep 1 or 2 repository elements with dynamically changing paths.