I get this error when i run my appium test case, below is my program
import java.net.MalformedURLException;
import java.net.URL;
import org.openqa.selenium.By;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
public class Sample {
@Test
public void m1() throws MalformedURLException, InterruptedException{
// Create object of desired class and specify android platform
DesiredCapabilities capabilities = DesiredCapabilities.android();
// set the capabilities to execute in chrome browser
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);
// set capability to execute our test in Android platform
capabilities.setCapability(CapabilityType.PLATFORM, Platform.ANDROID);
// need to define platform name
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, "Android");
// set device name
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "My Mobile");
// set version
capabilities.setCapability(CapabilityType.VERSION, "6.0");
// create object of url and assign appium server address
URL url = new URL("http://127.0.0.1:4723/wd/hub");
WebDriver driver = new AndroidDriver<>(url, capabilities);
driver.get("http://www.facebook.com");
System.out.println(driver.getTitle());
driver.findElement(By.name("email")).sendKeys("[email protected]");
driver.findElement(By.name("pass")).sendKeys("xxxxxxxxx");
Thread.sleep(10000);
}
}
Below is the issue which i got in eclipse
FAILED: m1
org.openqa.selenium.SessionNotCreatedException: A new session could not be created. (Original error: spawn "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" ENOENT) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 11.87 seconds
Build info: version: '3.5.3', revision: 'a88d25fe6b', time: '2017-08-29T12:54:15.039Z'
System info: host: 'ACC-H-SUHAAHME', ip: '172.18.201.83', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_144'
Driver info: driver.version: AndroidDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$24(ProtocolHandshake.java:359)
at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Unknown Source)
at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source)
at java.util.stream.AbstractPipeline.copyInto(Unknown Source)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
at java.util.stream.FindOps$FindOp.evaluateSequential(Unknown Source)
at java.util.stream.AbstractPipeline.evaluate(Unknown Source)
at java.util.stream.ReferencePipeline.findFirst(Unknown Source)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:362)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:136)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:89)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:646)
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(RemoteWebDriver.java:255)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:237)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:138)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:38)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:87)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:111)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:72)
at io.app.Sample.m1(Sample.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:645)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:756)
at org.testng.TestRunner.run(TestRunner.java:610)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
at org.testng.TestNG.runSuites(TestNG.java:1133)
at org.testng.TestNG.run(TestNG.java:1104)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
And this is the issue which i got on appium server
info: [debug] Using fast reset? true info: [debug] Preparing device for session info: [debug] Not checking whether app is present since we are assuming it's already on the device info: Retrieving device info: [debug] Trying to find a connected android device info: [debug] Getting connected devices... info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" devices info: [debug] 1 device(s) connected info: Found device PBG6WSCEM7QSTK69 info: [debug] Setting device id to PBG6WSCEM7QSTK69 info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" -s PBG6WSCEM7QSTK69 wait-for-device info: [debug] Retrying restartAdb info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" -s PBG6WSCEM7QSTK69 kill-server info: [debug] Getting connected devices... info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" -s PBG6WSCEM7QSTK69 devices info: [debug] 1 device(s) connected info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5) info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" -s PBG6WSCEM7QSTK69 wait-for-device info: [debug] executing cmd: "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" -s PBG6WSCEM7QSTK69 shell "echo 'ready'" info: [debug] Starting logcat capture info: [debug] Cleaning up appium session error: Logcat capture failed: spawn "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" ENOENT error: Failed to start an Appium session, err was: Error: spawn "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" ENOENT info: [debug] Error: spawn "D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe" ENOENT at exports._errnoException (util.js:746:11) at Process.ChildProcess._handle.onexit (child_process.js:1054:32) at child_process.js:1145:20 at process._tickDomainCallback (node.js:381:11) info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: spawn \"D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe\" ENOENT)","code":"ENOENT","errno":"ENOENT","syscall":"spawn \"D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe\"","path":"\"D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe\"","origValue":"spawn \"D:\softwares\Appium_New\android-sdk-windows\platform-tools\adb.exe\" ENOENT"},"sessionId":null} info: <-- POST /wd/hub/session 500 10417.138 ms - 510