Access toggle button in Android settings using appium whlie client is written in groovy and java

0
0

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 app for which I am writing automation, has to take android permission. My application navigates to following setting page of Android Settings as shown below.

enter image description here

To automate clicks on this page I have created a Page Object which would represent this screen. in this scenario I am only interested in toggling the Switch and to learn how to get it’s state.

I could get resource id for the UI Automator Viewer something like this.

enter image description here

So my initialization is something like this to access the switch Widget.

SwitchID { $("#switchWidget") }

Apparently, When i run the feature file, Appium is not able to find this switch widget. But I can automate other widget inside the application I am working on. but I can’t get anything on this setting screen of android.

Any help would be highly regarded.
Thanks

  • You must to post comments
0
0

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

  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website