Skip to content Skip to sidebar Skip to footer

Access Toggle Button In Android Settings Using Appium Whlie Client Is Written In Groovy And Java

It's not a duplicate. I am writing automation in Appium. I am fairly new to automation concept and Appium it self. I am using java-client. I have a scenario in which my android a

Solution 1:

You can access any visible component on UI. Be it buttons/ switches or whatever. There are several ways to access an element using Appium/ Selenium driver - By name/ id/ xpath, etc. Use UIAutomator to capture that visible element's id/name/ content desc and you're done! In your case, as I can see in UIAutomator screenshot - you are getting both id and name. So you can use any of them to click your desired element. (You can refer to your relevant groovy/java syntax from Appium) http://appium.io/introduction.html

Solution 2:

Using the java-client I would get the switch by class name. Something like this: driver.findElement(By.className("android.widget.Switch"))

Not sure about the groovy client, but it's probably similar.

Solution 3:

What if the switch is checked already? If you tap you will disable it...

Try:

driver.find_element_by_xpath("//android.widget.Switch[@resource-id='android:id/switchWidget' and @checkable='true']")

This will only get your element when is checkable

Post a Comment for "Access Toggle Button In Android Settings Using Appium Whlie Client Is Written In Groovy And Java"