UpdateSelector method

Hi,

I am using For Each loop in the flow chart. Inside there are few Get Full Text from Screen Scrapings. I would like to update the selector property in each loop for all the Get Full Text.

How can i using the UpdateSelector method to do this?

Thanks
@tshinming

1 Like

Hi @badita

Do u have any idea how to do it?

Thanks

Use a string variable within the Selector property.
Another option is to use wildcards: Get Help from UiPath Support Services | UiPath

The Edit Selector content

I need to change the tableRow from 2 to 51 when the loop is looping.

Let say the row is iRowStr, how can i include the string variable under Edit Selector?

Thanks

string selFormat ="<webctrl aaname='Part ID Title Loan ID *' parentid='loanpart-table' tag='TABLE' /><webctrl isleaf='1' tableCol='5' tableRow='{0}' tag='TD' />"

Please note the tableRow='{0}' within the string.

Within each iteration string selector = string.Format(selFormat, iRowStr.ToString)

Use the selector variable within the Selector property:

2 Likes

Thanks, can you please give me a little bit more details for this sentence " Within each iteration string selector = string.Format(selFormat, iRowStr.ToString)"

like,

I guess then, that iRowStr.ToString it has to be initialized in 0 and then:
iRowStr.ToString = iRowStr.ToString+1, right?

thanks,

Hi,
Almost - if you want to use arithmetic operations, iRowStr needs to be a number (Int should suffice).
Pseudocode:
int iRowStr;
string selector = [selector as Mihai showed it]
foreach (item in collection)
selector = String.Format(selFormat, iRowStr.ToString());
[do stuff]
iRowStr = iRowStr + 1;

You can’t assign to [variable].ToString, because that’s a method. Also doing a [string] + 1 would throw a syntax error, or even if it worked doing a + on a string appends that character at the end of the string, so you’d have 0, then 01, then 011 etc.

Regards.

2 Likes

u Rock !!! <ImI

thank you !!!

That’s correct.

string.Format is just an easier/elegant way to process strings. String.Format Method (System) | Microsoft Learn

You can use "<webctrl aaname='Part ID Title Loan ID *' parentid='loanpart-table' tag='TABLE' /><webctrl isleaf='1' tableCol='5' tableRow='" + iRowStr.ToString + "' tag='TD' />"
and you’ll get the same result.

1 Like

Thanks @badita

I am not able able to use place the selector variable in the selector property. I use the record button to record the action and i am not able to delete the contents under the selector edit box. If i created the actions (eg select, check) from the activities then i am able to key in iRowStr under the selector property. I also take informative screen for the action. I got the error “Check : The UiElement is not initialized”.

How do u generate the Get Full text? I scrapped from the screen itself.

Hi @badita

I have managed to solve it already after tried and errors for many times. Finally, i found the way to solve this issue.

Thank so much.

What did you do to solve this can you please share?

Hello Everyone

I want to read the text of each of the items below

however, it is throwing me this error,

Assign : Index (zero based) must be greater than or equal to zero and less than the size of the argument list.

I have inititialize a variable

iRow = 3
varSelector = “< wnd app =‘saplogon.exe’ cls=‘SAP_FRONTEND_SESSION’ title=‘Resumen de jobs’ /> < sap id=‘usr/lbl[63,’{3}‘]’ />”

do
selector = string.Format(varSelector.ToString, iRowStr.ToString())
///
“Get Text Activity” getting textMe as text result

using the selector
////

iRowStr = iRowStr + 1

while textMe.ToString <> “”

:dizzy_face: but it’s throwing me the error mentioned above.

updateselector-method.xaml (73.7 KB)

Hi,

If you use {3} in a string that you later put through String.Format, it will try to substitute the 4th argument there.

If you want to insert the iRowStr in place where the {} are, put {0} there.

Regards.

2 Likes

@andrzej.kniola You are a Genious, now I understand this format explanation VB.NET String.Format Examples: String and Integer - Dot Net Perls

It works perfectly now!! I’m so happy… .:grinning: :grinning::sunglasses:

3 Likes

hi @beesheep

Sorry, i just saw the message from you.

1 Like