Searching through UI and click right Button

Hi,

I have a website with the following UI as shown below.
I need to check my “TC Number”(For ex: my TC is 859634/00960023) and click on a button to the right if it is the right TC number or else I check the second “TC Number” and so on…

How can I do this please?
Thanks!

I think u had to make the dynamic selector approach so that based on tc number it will click the edit button

1 Like

Can you tell me which activities to use please?

Hi @Yudhisteer_Chintaram1 !
So that we could help you, use UiExplorer option (in uipath studio ribbon) and indicate the element on two things:

  • on 859…23 (at the column TC Number)
  • on the edit button of the same line
    Screenshot both results

Here are the screenshots for the TC and Button

Thanks, could you rescreen again to let us also see the element on the right highlighted in red in my picture ?

Button:

TC Number:

Great, thanks !
So the exercise here is to find a common link between these two screens, but also the main difference.
Here as you can see, on the right of both those two screenshots, we have:

  • a common “id”, which is rowName and indicates the line where it is (like a horizontal coordinate)
  • and a very specific “type” for each of them, which is colName for TIC, and tableCol for the button (like a vertical coordinate)

So what are you going to do first is to check: colName, tableCol, and rowName. Once you do it, verify if the selectors are still valid.

Then for both, take the result of the selector in a string and assign it as a hardcoded value (let’s call them selector_tic and selector_btn)

Then send us in text format the selectors so we keep going ^^

1 Like

Okay so the selectors are still valid. And I assigned them to two variables: selector_Button and selector_TC.

selector_Button:
"(<webctrl aaname='Edit TC' tableRow='2' tag='BUTTON' rowName='1' tableCol='10' />)"

selector_TC:
"<webctrl aaname='# TC Number Buyer Name TC status Buyer PO Number Net Weight (kg)*' tag='TABLE' /> <webctrl tableCol='2' tag='TD' colName='TC Number' rowName='1' />"

Can you help me please?

Sure !
I didn’t see that you answered x)
Ok after this, we have to edit a little bit more your hardcoded selectors so they become dynamic as NIVED_NAMBIAR said.

"<webctrl aaname='Edit TC' tableRow='2' tag='BUTTON' rowName='+"index_of_row.toString+"' tableCol='10' >"

"<webctrl aaname='# TC Number Buyer Name TC status Buyer PO Number Net Weight (kg)*' tag='TABLE' /> <webctrl tableCol='2' tag='TD' colName='TC Number' rowName='+"index_of_row.toString+"' />"

index_of_row is supposed to be an Int32 that will contain the index of your row.
Next step is to see if UiPath is able to extract the page you’re showing us into a datatable.
Click on the following button, and indicates the field 859…23; it will ask you if you want to extract the whole datatable (you can say yes or no it doesn’t matter), then it will ask you to target another element of the same type (so you will have to indicate the next field TC Number in the line 2), then it will ask if there are more pages to scrape (if yes indicate the “next” arrow down the page)

Does it scrape successfully the datatable ?

Hello,

Thanks for replying!

Yes it scraped the data. I could see it in the output panel.
I have added an Input Dialog box just before the data scraping so that the user inserts the TC number and is stored in a string variable called “inputTCNumber”.
We could cross-check with the ExtractedDataTable and click the right button.

I have removed the double quotes around “index_of_row.toString+” as I was getting an error. They are now as such:

"<webctrl aaname='Edit TC' tableRow='2' tag='BUTTON' rowName='+ index_of_row.toString +' tableCol='10' >"

"<webctrl aaname='# TC Number Buyer Name TC status Buyer PO Number Net Weight (kg)*' tag='TABLE' /> <webctrl tableCol='2' tag='TD' colName='TC Number' rowName='+index_of_row.toString+' />"`

What do we do next please?

@Yudhisteer_Chintaram1
You need the double quotes so that UiPath Studio understands that index_of_row is the int32 and not a string expected in the selector x)
Would you mind showing me what is the error ?

Meanwhile for the next step, you need to:

  • loop in the ExtractedDataTable with a foreach row activity, and in the output index put index_of_row
  • inside the foreach row, use an IF activity with the following condition:
    inputTCNumber = row(“TC Number”).toString
  • Then use assign activity, with selector_btn = "<webctrl aaname='Edit TC' tableRow='2' tag='BUTTON' rowName='"+(index_of_row+1).toString+"' tableCol='10' />"
  • Then use click activity, and in the input, at the field selector, put selector_btn

That’s it :grin:

1 Like

I just noticed that I put badly the double quotes, i corrected it in my last post: sorry !

It is okay now. Earlier you wrote: '+"index_of_row.toString+"'. It should be: '"+index_of_row.toString+"'. The first plus sign should be inside the double quotes. A typo :slight_smile:

The TC selector is as such in one line though:

"<webctrl aaname='# TC Number Buyer Name TC status Buyer PO Number Net Weight (kg)*' tag='TABLE' /><webctrl tableCol='2' tag='TD' colName='TC Number' rowName='"+index_of_row.toString+"' />"

Perfect !
Try what I suggested, if it does not work then we will maybe need the second selector (selector_tic)

Is it like in the screenshot below:
It does not work though. Instead the cursor is Click at the TC Number and not the Button!

Yes, I have mistaken the selecor… just edited my answer