Code:
public class AppDAta {
public static URL url;
public static DesiredCapabilities capabilities;
public static AndroidDriver driver;
//1
@Check
public void setupAppium() throws MalformedURLException {
//2
ultimate String URL_STRING = "http://127.0.0.1:4723/wd/hub";
url = new URL("http://127.0.0.1:4723/wd/hub");
//3
DesiredCapabilities cap= new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Nexus_4_API_27");
cap.setCapability(MobileCapabilityType.PLATFORM_NAME, "android");
cap.setCapability(MobileCapabilityType.PLATFORM_VERSION, "3.6.0");
cap.setCapability(MobileCapabilityType.APP, "/Customers/uss/Desktop/untitled folder/Appium/src/major/java/Appium/ApiDemos-debug.apk");
cap.setCapability(MobileCapabilityType.NO_RESET, true);
// cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
cap.setCapability("useNewWDA", false);
//4
AndroidDriver driver = new AndroidDriver(url, cap);
driver.handle().timeouts().implicitlyWait(2, TimeUnit.SECONDS);
//driver.resetApp();
}
}
Getting one of these error in console:
FAILED: setupAppium
org.openqa.selenium.WebDriverException: An unknown server-side error occurred whereas processing the command. Authentic error: Couldn't discover 'adb' in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT atmosphere variables to the corect Android SDK root listing path.
Construct information: model: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System information: host: 'tests-Mac-mini.native', ip: 'fe80:0:0:0:431:f1c:51d3:566apercenten0', os.identify: 'Mac OS X', os.arch: 'x86_64', os.model: '10.13.6', java.model: '1.8.0_111'
Driver information: driver.model: AndroidDriver
distant stacktrace: UnknownError: An unknown server-side error occurred whereas processing the command. Authentic error: Couldn't discover 'adb' in PATH. Please set the ANDROID_HOME or ANDROID_SDK_ROOT atmosphere variables to the corect Android SDK root listing path.