Increment index in a selector

selector
uiautomation
variable

#1

I want to increment a selectors index for an automation practise. This so the automation dont write information in the same cells everytime. Do anyone have a idea how i can do this? Attach the selector code:

<wnd app='expenseitdemo - postnord.exe' cls='HwndWrapper*' title='Create Expense Report' /> <ctrl idx='16' role='editable text' />


#2

Hello.

You need to insert a variable inside the selector. For instance in this case:

wnd app=‘expenseitdemo - postnord.exe’ cls=‘HwndWrapper*’ title=‘Create Expense Report’ />
ctrl idx=’"+[Increment name]+"’ role=‘editable text’ /

Selectors are just string variables so you can format them in many ways.


#3

Ok, i tried and got this message:

Main has thrown an exception

Message: Cannot find the UI element corresponding to this selector:

<wnd app='expenseitdemo - postnord.exe' cls='HwndWrapper*' title='Create Expense Report' /><ctrl idx='&quot;+ [incrementID] +&quot;' role='editable text' />

Source: Type into ‘editable text’

Exception Type: SelectorNotFoundException

I did an assign activity (string), incrementID -> “16”


#4

You will need to change the selector and instead of [incrementID] insert a variable. I have attached a workflow as an example. Let me know if you still encounter issues.

IncrementTypeDemo.xaml (6.6 KB)


#6

Still not get it. Attach my file:

Main.xaml (13.0 KB)

(The * was just a chance)

Where have i done something wrong?


#7

Hey @SoJo

For your reference: SampleIncrement.zip (109.8 KB)

Regards…!!
Aksh