how to enable/disable mobile data and Settings Tab in an Android Device

Question

I need to enable/disable the Mobile Data, enable/disable bluetooth and play around with the Settings of the Android Device. How can i achieve this using the Katalon tool >

Kindly help in this pls.

in progress 1
How to 7 Answer 71 views

About the Author

Answers ( 7 )

  1. This comment is edited.

    Hi Santosh,

    Actually, we have not provided yet keywords for your scenario. However, you can work around as below steps:

    1. You should pin the Android Settings to the home screen
    2. In Mobile Object Spy, you start with any application (This keyword will start your Appium session)
    3. You press home on your real device and click Capture Object in Object Spy
    4. Now, you can capture the Android Settings and continue your scenario

    • Thanks for the reply. Now does Appium have the feature to automate the Settings of the Android UI, like can we be able to Enable/Disable mobile data etc.

      Pls let me know in case of Appium Tool.

      Now instead of Manually pressing the Home Button on the real device, can i use some Katalon APIs to go to the Home Screen. Kindly let me know.

  2. Hi Santosh,

    1. Yes, you can automate some settings of Android device (Bluetooth, Cellular Data). For now, we don’t have any keywords supported this action but you can create a custom keyword as below:

    boolean isAirplaneOn = false;
    boolean isWifiOn = false;
    boolean isDataOn = false;
    AndroidDriver androidDriver = (AndroidDriver) MobileDriverFactory.getDriver()
    androidDriver.setNetworkConnection(new NetworkConnectionSetting(isAirplaneOn, isWifiOn, isDataOn))

    2. Sure, you can use “Press Home” keyword to navigate to the home screen during your execution. However, you have to manually do it when you use the Mobile Object Spy.

    Thanks.

    • Thanks. Now i tried to do the steps as mentioned in your first comment, but there are many failures that i have come across.

      Is it possible to have a view of the Android UI ( virtual emulator view) when i click on the Mobile Spy, or even during the runtime/execution of the code, since i dont see the Virtual Emulator coming up on the screen. I always have to look at the real device to check on the operations done by the code.

      Pls provide your comments.

  3. I see android.widget.Switch0 – OFF, for the USB Tethering option. I need to enable this android.widget.Switch0 – ON. How can i achieve this.

    Can you also pls help me to attach the screenshot in this ticket. I cannot see an option to attach the attachment here.

  4. Hi Santosh,

    1. I have to confirm you that the Device View is only displayed in Mobile Object Spy/Record.

    2. With regards to your first concern of this topic, I think you should use my provided code since the solution in my first comment is just a work around.

    3. We’re so sorry for the inconvenience that we are not able to upload photos via this forum at this moment. Please upload your photo to another host and send us the hyperlink.

    4. “I see android.widget.Switch0 – OFF, for the USB Tethering option. I need to enable this android.widget.Switch0 – ON. How can i achieve this.” I’m sorry I’m confused about this concern, could you please specify it?

  5. I would agree with Point 1) said.
    For the code provided by you earlier, is the MobileDriverFactory a class declared as part of this Katalon tool. Pls let me know.
    As i did the recording on the Andorid UI, i go to Settings, and then to the USB Tethering Option, its got a slider there and when i capture that , it shows me “android.widget.Switch0 – OFF” indicating that USB Tethering is disabled, so i wanted to enable USB Tethering by using something like “android.widget.Switch0 – ON”. How can i achieve this.

Leave an answer