Handling click in datagrid (windows based) and manage dynamic selectors

Hello,
I am working on windows based application, i need to read data from excel and click in my application (datagrid ), Final job is to click, the selector code for click is based on Row number
e.g:
Excel
In the above excel, i need to capture cell value for the column:Selected & compare with other columns: Row Num & Option Name. Click matched row finally

My Click selector code as below:
< wnd ctrlname=‘panel20’ />
< wnd ctrlname=‘panel3’ />
< wnd ctrlname=‘tmmvgTab’ />
< wnd ctrlname=‘OptionsTabPage’ />
< wnd ctrlname=‘panel5’ />
< wnd ctrlname=‘optionDetailsTab’ />
< wnd ctrlname=‘FrameDeptOptionsTabPage’ />
< wnd ctrlname=‘FrameDeptGridView’ />
< ctrl name=‘DataGridView’ role=‘table’ />
< ctrl name=‘Row 16’ role=‘row’ />
< ctrl name=’# Row 16’ role=‘cell’ />

My idea is to read selected value (from excel) in a variable, compare with other 2 columns and find out the matching row number and click the row number.
i need to modify the selector code for click event , please help how to proceed.
Thanks in advance.

To confirm, you want to grab the data in column ‘selected’ from your excel.

If this matches the ‘Option Name’ column you want to grab the ‘Row Num’, e.g. as variable ‘RowNum’.

The bot will then need to find and click on the selector with the attribute < ctrl name=RowNum role=‘row’ />

?

Yes, correct.

As I don’t have access to your web app, this is incomplete. You will need to indicate:

  • The target for the FindChildren activity, namely, your application table which you will be attempting to click. This will generate a table of selectors for you to analyse further into the workflow. This may need to be surrounded by an ‘AttachBrowser’ or ‘AttachWIndow’ depending on the nature of your app.

  • The final click activity will also need to be surrounded by an ‘AttachBrowser’ or ‘AttachWIndow’ if required.

The workflow takes the list of possible selectors and where a match between ‘Selected’ and ‘OptionName’ is found, looks for the corresponding matching RowNumber. If it finds this, (“ctrl name=”+RowNumber) then it will click that selector and move onto the next transaction item to process.

Main.xaml (12.1 KB)

Hi ronanpeter,
Thank you , my application is windows based stand alone, i did not understood your solution, could you please elaborate more , i have the below doubts:

  1. Where is the input capturing (we have an excel file)

  2. How do I find the child elements for the datagridview. My selector is as follows:

    < wnd app=‘winquote.exe’ ctrlname=‘TMMVGForm’ />
    < wnd ctrlname=‘panel20’ />
    < wnd ctrlname=‘panel3’ />
    < wnd ctrlname=‘tmmvgTab’ />
    < wnd ctrlname=‘OptionsTabPage’ />
    < wnd ctrlname=‘panel5’ />
    < wnd ctrlname=‘optionDetailsTab’ />
    < wnd ctrlname=‘FrameDeptOptionsTabPage’ />
    < wnd ctrlname=‘FrameDeptGridView’ />
    < ctrl name=‘DataGridView’ role=‘table’ />

I tried with wnd ctrlname = FrameDeptGridView & ctrl name Datagridview but it is not returning any children elements as rows.
I debugged the sequence and checked but no children are returned into lstChildren.
I placed the FindChildren & Foreach activities inside Attach Window.

  1. I have used a generate datatable just for this example, however, you should replace that with your own input data through a read range on your excel for example.

  2. You should click on the ‘indicate on screen’ option and highlight your full datagrid on the application.

image

Ensure that there are individual element for the values you are looking to click and that that the table is not just one single element. There should be at least one element returned to lstChildren if you have highlighted the datagrid as directed. However, as we want all descendants of that element, there should be more. The end result should be a table containing all element selectors for further analysis.

Thank you, the find children is returning with data type as IEnumerable.
I have a query here, the returned children elements from the grid are

UiElement[1]
{
UiElement
{
ClippingRegion=null,
Selector="< wnd app=‘winquote.exe’ ctrlname=‘TMMVGForm’ />
< wnd ctrlname=‘panel20’ />
< wnd ctrlname=‘panel3’ />
< wnd ctrlname=‘tmmvgTab’ />
< wnd ctrlname=‘panel5’ />
< wnd ctrlname=‘optionDetailsTab’ />
< wnd ctrlname=‘FrameDeptOptionsTabPage’ />
< wnd ctrlname=‘FrameDeptGridView’ />
< wnd aaname=‘Vertical Scroll Bar’ cls=‘WindowsForms10.SCROLLBAR.*’ />"
}
}

It was not able to return the contents of the grid.

Your For Each loop should provide the details of the various elements in the datagrid.

So if a certain part of the datagrid is clickable, that is, it has its own selector, you can see what these selectors look like using for ForEach loop:

Each selector should be unique and its just a question then of identifying which selector you want based on your previous matching exercise.

1 Like

Yes, I was able to loop into the elements list, but I cannot find the data inside the grid element. When I debugged the sequence the element only consists of

UiElement[1]
{
UiElement
{
ClippingRegion=null,
Selector="
< wnd app=‘winquote.exe’ ctrlname=‘TMMVGForm’ />
< wnd app=‘winquote.exe’ ctrlname=‘TMMVGForm’ />
< wnd ctrlname=‘panel20’ />
< wnd ctrlname=‘panel3’ />
< wnd ctrlname=‘tmmvgTab’ />
< wnd ctrlname=‘OptionsTabPage’ />
< wnd ctrlname=‘panel5’ />
< wnd ctrlname=‘optionDetailsTab’ />
< wnd ctrlname=‘FrameDeptOptionsTabPage’ />
< wnd ctrlname=‘FrameDeptGridView’ />"
}
}
How can I find the data inside the grid?

It looks like your datagrid is being rendered as a single element, rather than a collection. Two ways to check for sure. First, change the scope of the FindChildren activity to ‘Find_Children’. What is the output when you write the selectors to string as before?

Second, use the UiExplorer to click on a specific value in your datagrid. What does the selector look like? Does it allow you to click on the individual elements as you need?

image

1 Like

Hi @cschevuri,

Can you try DataScraping to get the grid data.

Regards,
Sasikumar K

Thank you , finally it worked as below:

  1. Created data table from data scrapping
  2. Read excel scope and given the input variable in excel.
  3. Using for each row, compared the row by row.
  4. Through if identified the row (rowGrid(2).ToString() = rowExcel(1).ToString())
  5. Finally, click event.
2 Likes

Thank you for your idea !!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.