Searching through UI and click right Button

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

It worked only for the first TC though. When I put the TC below it, I got this error:

Ok, could you use UiExplorer on the second edit button and share the screenshot ?

Here it is:

I did this and it worked!!!

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

Thank you thank you thank you!!! God bless you!!!

P.S Can you help me in this one also please?

1 Like

That’s great !!! Happy that you understand the logic of dynamic selectors and how to adapt them now :grin:

1 Like

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