I am using below code to launch android driver. But I am getting error at the time of launching the driver. On line:
driver = new AndroidDriver<WebElement>(new URL(appiumServiceUrl), capabilities);
Complete Code:
public class Test {
protected static AppiumDriver<WebElement> driver;
private AppiumDriverLocalService appiumService;
private String appiumServiceUrl;
Properties prop = new Properties();
@org.testng.annotations.Test
public void testappiumdriver() throws FileNotFoundException, IOException
{
appiumService = AppiumDriverLocalService.buildDefaultService();
appiumService.start();
appiumServiceUrl = appiumService.getUrl().toString();
prop.load(new FileInputStream("device_capabilities.properties"));
Map<String, String> prop_map = new HashMap<String, String>();
for (String key : prop.stringPropertyNames()) {
prop_map.put(key, prop.getProperty(key));
}
DesiredCapabilities capabilities = new DesiredCapabilities(prop_map);
driver = new AndroidDriver<WebElement>(new URL(appiumServiceUrl), capabilities);
}
}
Error:
FAILED: testappiumdriver org.openqa.selenium.WebDriverException: It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:24:21.231Z' System info: host: 'PSL-GGN-597', ip: '192.168.2.137', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_91' Driver info: driver.version: AndroidDriver at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:195) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:209) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:231) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at io.appium.java_client.android.AndroidDriver.execute(AndroidDriver.java:1) at org.openqa.selenium.remote.RemoteWebDriver.startSession at org.openqa.selenium.remote.RemoteWebDriver. (RemoteWebDriver.java:130) at io.appium.java_client.DefaultGenericMobileDriver. (DefaultGenericMobileDriver.java:38) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:84) at io.appium.java_client.AppiumDriver.(AppiumDriver.java:94) at io.appium.java_client.android.AndroidDriver.(AndroidDriver.java:93) at test.Test.testappiumdriver(Test.java:37)
I am using below jars in my project:
selenium-java 3.13 selenium-server 3.13 java-client 6.1.0
I have also tried with different version of selenium and java-client but again getting same error.