Dynamic selector is not working in windows application

Hello All,

I want to dynamically select orderid from the list and double click on it so that it navigates to order page. From the picture
selector for order id # 726810 :
"< wnd app=‘case (9).exe’ cls=’#32770’ />
< wnd ctrlid=‘12546’ />
< ctrl name=‘726810’ role=‘list item’ /> "

selector for order id # 726809 :
"< wnd app=‘case (9).exe’ cls=’#32770’ />
< wnd ctrlid=‘12546’ />
< ctrl name=‘726809’ role=‘list item’ /> "

Attribute “name” alone is changing , so i created a variable called “orderid” and inserted in dynamic selector like below .
< wnd app=‘case (9).exe’ cls=’#32770’ />
< wnd ctrlid=‘12546’ />
< ctrl name=’"+orderid.ToString()+"’ role=‘list item’ />

It is not showing any errors but also not selecting the orders which i pass as parameter. Please help me , what i’m supposed to do here.

@yashwanth_ms

What activity are you using to do this ?

Hi @yashwanth_ms

Your selector seems to be fine. However in desktop applications, when automating drop down items you cannot directly select the value as we do in web applications. So for desktop application dropdowns, you first need to add a click activity on the drop down which will expand the list. The. Use another click avtivity (which you have already) to select the value. Then it will work.

I have done a good explanation on this along with a working workflow solution in the below post. You may refer to that as well…

Facing the error in Drop-down box for windows application - #3 by Lahiru.Fernando

Let know whether this works for you. If it works, please mark my answer as the solution too…

I’m using double click activity

image

I’m already using double click activity and btw it is List element not a dropdown

this is the error i’m getting

image

Hi @yashwanth_ms,

Can you print the value of below expression and check if it same as of above 2 selectors which you have mentioned in your first post

< wnd app=‘case (9).exe’ cls=’#32770’ />
< wnd ctrlid=‘12546’ />
< ctrl name=’"+orderid.ToString()+"’ role=‘list item’ />

After you print the above expression copy the same in UIexplorer and check whether its validating or not and remove and extra spaces if any.

It is not validating.

Hi @yashwanth_ms

After printing the expression is the selector same as the above 2 you have mentioned.

Can you provide the expression you have printed.

The error which you are getting cannot find the selector is because if you see one your attribute ctrl name where you are passing order id has an extra &quot at start and end and thats y its not validating try to remove it and then use it in uiexplorer and try to validate it

while giving the selector ,i’m only using like this “+variableName+” but when i’m opening the selector again or after the run , it is displaying as shown in the error .

I did not understand , printing thing you are talking about . how do you want me to print?

The dynamic selector you will be using in assign statement right, use write line and print the dynamic selector.

So in your dynamic selector, can you use wild cards and as shown below and try to validate
image

somehow it is not taking the values i’m passing in . i tried whatever you said but no luck . it is printing as shown in error only

Did you try validating the selector after providing wild card in Uiexplorer.

If it still doesn’t work the issue is will selector , you have to make it more dynamic and search for any other attribute which is unique like Issue ID and remove order ID

do you have sometime to talk to me via hangouts or any medium , so that i screen share. it would be a great help. myemailid : yashorugallu@gmail.com

Hi @yashwanth_ms,

Okay, so I have come across this scenario a few times. This usually occurs when you use the ‘indicate element’ using click activity’s functionality; then edit the selector with the variables, to try and make it dynamic.

In my case, I have a hard time making that work sometimes.

So here’s what I do, and I know works! (and hopefully will solve your issue as well),

  1. Identify the selectors - You have already identified the selectors and “what’s changing” and where to place the variable.
  2. Drop-in a new click activity and DO NOT indicate the element.

  1. Instead, open the properties panel of the New ‘Click Activity’ and edit the selector field using the expression editor.
    You’ll notice this opens up more like a text-box than the usual ‘selector’ field.
    image

  2. Enclosed in double-quotes, place in your prepared selector (along with the variable adjustments) in this field.

  3. Hit OK.

  4. Try it Out!

Your selector is probably going to be something like below:

< wnd app=‘case (9).exe’ cls=’#32770’ />
< wnd ctrlid=‘12546’ />
< ctrl name=’"+orderid.ToString+"’ role=‘list item’ />

Try this out, and let us know what does and doesn’t work for you!

Regards,
Abdullah

your “” becomes quote.Try modify selector at property panel, remember not open the selector.image

@yashwanth_ms,

Try like this
< wnd app=‘case (9).exe’ cls=’#32770’ />
< wnd ctrlid=‘12546’ />
< ctrl name=’"+orderid.ToString+"’ role=‘list item’ />
After ToString, remove the brackets and try

Hi @yashwanth_ms,

@gareth_Hua is right:

It’s a known bug which firstly will change your "+<variable>+" for quote;+<variable>+quote;. You need to edit selector manually not through UiExplorer but from Properties pane and change again quote; for ". This should work then.

3 Likes

Yeah Thanks abdullah . With fresh selection of activity and changing the selector directly from properties pane , dynamic selector is working fine .

2 Likes