How to read on/off switch and change result respectively

I did get attribute of inner html and here it is displayed in a message boxget

@eonofrey I guess we’ll need to Access the Checked Property from the Selector, Have you tried Get Attribute with “checked” as it’s value ?

@eonofrey
it is recommended to explore the input elements “checked” attribute

Can you please explore it in uiexplorer for both cases (dont forget to refresh uiexplorer, after toggeling or do analysis with a new freshed openend uiexplorer)

Or use a get Attribute activity, let point the selector to the input element and log out the value of the checked attribute, to see if its toggeling

Thanks

1 Like

i dont think that checked is part of the offered selector items for this input element, thats why we are interested on this via get attribute

1 Like

Yeah I agree because this is the error I get when I do the Get Attribute activity with “checked” as the attribute!

1 Like

You are very close: share the selector with us, but please use the format code </> Button from the editior for this

Feel free to do this RnD isolated in a seperate XAML only focussing on this checked retrieval.

1 Like

i hope you are using the selector for the input and not the label…

Haha yea I am, I am choosing from the drop down options, then passing the output to the variable of “attribute” to put in a message box!

1 Like

When you say share the selector with us, I don’t know what part you need to see. Can you show me an example so I can get you the right information?

Thanks for your help,

1 Like

@eonofrey

DEMO is done with another onoff switch, dont assume values has to be the same as at your end. BUT we are interessted on the input element

it is to ensured that the selector is configured to the input element. You used an get attribute activity
in such scenarios the selector has to readjusted:

grafik
click the menue button, select edit selector

grafik
Click on Open in UI Explorer

Locate the corresponding input element in the tree
grafik
do right click on the input element and choose select as target, wait for updating the selector information

if it was sucessfully the you will see the change to tag='INPUT
grafik

confirm it with save
grafik
here you see the selector from which we were talking. this one is used to retrieve the checked attribute value

confirm it with OK

force the get attribute to use the checked attribute with hardcoding “checked”
grafik

so run and test it.

the benefit to do this analysis (is checked toggeling) directly in uiexplorer is that it can be done faster
the benefit to check only get attribute in a separate xaml is, the isolated test case, not confused with others

E.G your exception from above could come from that the click on the element needs more time and the get attribute is executed too fast. so the retrieval is done against a not ready element.

let us know your open questions

2 Likes

I got it working using Find Image.
Check this sample i created. i did it in maps.google.com
To run this, open maps, search for a location.
Cllick on directions.
In center bottom of the page, you will see a option to enable / disable Live Traffic.
Just keep that page open.
and run this sample project.
If live tracking is enabled, this project will disabled it, if its disabled, it will enable it.

Hi Peter! I did as you said and it worked like charm! Thank you!