I’m using appium/java/maven for some automated tests for an app. Currently I’m just grabbing the apk location via absolute path in my project:
cap.setCapability(MobileCapabilityType.APP, "D:\\abs\\path\\src\\main\\resources\\testapp.apk");
This works locally, but I need to be able to execute this a different machine (via mvn commands), so this won’t work. I read online to grab the apk file from compiled class folder (target/classes/testapp.apk), which I did below:
ClassLoader classLoader = getClass().getClassLoader();
File apkFile = new File(classLoader.getResource("testapp.apk").getFile());
But when I run I get an error:
org.openqa.selenium.json.JsonException: Unable to determine type from: D. Last 41 characters read: {
"desiredCapabilities": {
"app": D
Error seems to me like it has part of the path (my local drive for this is D) but something is wrong with the full path.
Anyone have any ideas here? Am I mising something? Or is there a better approach for this?
Thanks!