Selector Attribute Exact Match

Hi, I am working on automating a desktop app. The application has some buttons which gets only available after entering the required data. Now I want to check if a specific button is available or not based on the ‘aastate’ attribute. When this specific button is available the ‘aastate’ attribute has the value ‘focusable’ and if it’s not available the value is ‘unavailable, focusable’. Now I want my selector to search for the exact value of the ‘aastate’ attribute which is ‘focusable’. Any help highly appreciated. I know I can check the value of ‘aastate’ attribute value later on but I want to know if there exist a way of directly doing that within the selector.

Thanks in advance.

Hi @himanshu_punj1

Try this selector

<wnd app= ‘your_application.exe’ cls=‘your_class’ title=‘your_title’ />
<ctrl=‘your_button_name’ role=‘push button’
aastate=‘focusable’/>

Note that if the ‘aastate’ attribute has multiple values, you can use the ‘contains’ operator to search for a partial match. For example, you can use ‘aastate=‘unavailable, focusable’’ to search for the button element when the ‘aastate’ attribute has both ‘unavailable’ and ‘focusable’ values.

HI @Nitya1 thanks for your reply. I did try aastate=‘focusable’ but that matches both the scenarios. What I want is if the value is ‘Unavailable focusable’ then it should not match but if the value is only ‘focusable’ then it should match.

hi

Did you try check element activity to check if enabled
or get attribute activity to get the aastate and verify it is only focusable in retry activity
or wait attribute to check if the aastate as focusable

Regards

Hi @himanshu_punj1

You can use the “If” activity with a condition that checks the value of the attribute you want to match. Here’s an example :-

yourAttribute.Contains(“focusable”) And Not yourAttribute.Contains(“Unavailable focusable”)

@himanshu_punj1

In selector try regex match

aastate = ‘^focusable$’ matching:aastate=‘regex’

Cheers

1 Like

Hi @Anil_G thanks for your reply. That was what I exactly needed!

1 Like

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