TransWikia.com

How to set app path for android using Appium on a mac

Software Quality Assurance & Testing Asked by user1523236 on February 3, 2021

I wish to know how to set the app path for an android app on my mac. For iOS you can download the app and then in the desired capabilities you can provide the path.

I can’t download the android version of the app onto my mac, but it is my understanding that I can use the android emulator and then install the app on it.

So how do I set the app path for this?

5 Answers

You can also provide URL into "app" capability. It even supports basic access authentication.

Answered by Risinek on February 3, 2021

  1. You should have .apk file with you and provide path in file path for mac(/filename.apk) on windows(\filename.apk)

example:

String apkpath="/Users/fidel/Downloads/Test.apk";
File app=new File(apkpath);

then set the below capability

capabilities.setCapability("app", app.getAbsolutePath());
  1. Connect device and pair your system
  2. Run Appium (you can see log on Appium)

Answered by sameer joshi on February 3, 2021

You can absolutely download an apk file to your mac. If you are getting the apk off of a build server, just download and then provide the path to the app within the appium gui. If you are using command line, provide the path in your desired capabilities.

Alternatively, you can install android studio and get access to source code. Then build from source and provide the build path to the GUI or capabilities.

Answered by Bebop_ on February 3, 2021

File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "app/build/outputs/apk/");
File app = new File(appDir, "app-debug.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName","Android");
capabilities.setCapability("appium-version", "1.0");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "Your package name");
capabilities.setCapability("appActivity", "MainActivity");

Explanation:

Line 1: Get the Path to your Project's Root Directory O/P: classPathRoot: /Users/john.doe/AppiumProject/app

Line 2: Append the Path to the Directory of the folder where your ".apk" is placed, with the Project's Root Directory. O/P: classPathRoot: /Users/john.doe/AppiumProject/app/build/outputs/apk/

Line 3: Append your ".apk" file name, with the Project's Root Directory(till your apk folder). O/P: classPathRoot: /Users/john.doe/AppiumProject/app/build/outputs/apk/apk-debug.apk

Line 4 and onwards: Initiate Desired capabilitieas and set them as per your platform and device

Answered by Suman on February 3, 2021

appPackage and appActivity capabilities should be used for installed Android apps.

They both can be found in the output of adb logcat command.

  1. Connect a device or launch an emulator;
  2. Execute your app;
  3. Execute adb logcat command;
  4. Search the output for Activity.

Answered by Dmitry Cheremushkin on February 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP