I was trying to open the contacts list of my mobile through the code given below but the piece of code is showing me error when trying to instantiate the Appium driver.
public class TestContactsNativeApp {
public static AppiumDriver driver;
public static void main(String[] args) throws MalformedURLException {
DesiredCapabilities capabilites = new DesiredCapabilities();
capabilites.setCapability("device", "Android");
capabilites.setCapability("deviceName", "Samsung S5");
capabilites.setCapability("platformVersion", "4.4.2");
capabilites.setCapability("platformName", "Android");
capabilites.setCapability("appPackage", "com.android.contacts");
capabilites.setCapability("appActivity", "com.android.contacts.activities.PeopleActivity");
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilites);
}
}
"Cannot instantiate the type AppiumDriver" error is getting displayed on hovering the AppiumDriver in the above code.
The solution of this issue is use "AndroidDriver" in case of Android devices and "IOSDriver" in case of IOS devices instead of "AppiumDriver".
Eg:
driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilites);
0 Comment(s)