How to get the ToggleSwitch state's text (OnContent/OffContent)
See original GitHub issueIn UWP apps it is possible to set the On/Off text for a ToggleSwitch
control.
I can find the on/off state from the selected
property. Is there a way to get the actual text (OnContent/OffContent)? It would be great if it is possible as the tests would match what is there on the UI.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to get the ToggleSwitch state's text (OnContent ...
In UWP apps it is possible to set the On/Off text for a ToggleSwitch control. I can find the on/off state from the...
Read more >How to get the switch toggle state(true/false) in javascript
The jquery if condition will give you that: var switchStatus = false; $("#togBtn").on('change', function() { if ($(this).is(':checked')) ...
Read more >Should a toggle button show its current state or the state to ...
Use the action as the text of the toggle button, not the state. Make sure the button isn't highlighted. Highlight the action on...
Read more >Toggle Button - Ignition
In the Property Editor, select All for the filter properties. Now you will be able to change the text based on state, but...
Read more >Toggle-Switch Guidelines
Toggle switches are best used for changing the state of system functionalities and preferences. Toggles may replace two radio buttons or a ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@timotiusmargo @hassanuz I am able to find a workaround for the issue. The reason we are not able to use UIAutomation to access the children of ToggleSwitch is the AccessibilityView value of
Raw
set forOffContent
andOnContent
properties. Pay attention toAutomationProperties.AccessibilityView="Raw"
, this makes it visible to UIAutomation clients only when raw filter is used.To solve this, either WinAppDriver should be using the raw filter to look at the UIAutomation tree or we can re-template the ToggleSwitch control, without the
AutomationProperties.AccessibilityView="Raw"
.Closing comment as original issue has been addressed - and workaround has been found.