UpdateSelector method

selector

#1

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


How to select the checkbox in HTML table
#2

Hi @badita

Do u have any idea how to do it?

Thanks


#3

Use a string variable within the Selector property.
Another option is to use wildcards: https://www.uipath.com/guides/selectors-with-wildcards


#4

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


#5

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:


#6

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,


#7

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.


#8

u Rock !!! <ImI

thank you !!!


#9

That’s correct.

string.Format is just an easier/elegant way to process strings. https://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx

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.


#10

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.


#11

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.


#12

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


#13

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)


#14

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.


#15

@andrzej.kniola You are a Genious, now I understand this format explanation https://www.dotnetperls.com/format-vbnet

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


#16

hi @beesheep

Sorry, i just saw the message from you.