public void setUp() throws Exception {
// set up appium
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "../../../apps/ContactManager/");
File app = new File(appDir, "ContactManager.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
System.out.print("test1");
capabilities.setCapability("deviceName","AVD_19");
// capabilities.setCapability("PlatformName","Android");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", "com.example.android.contactmanager");
capabilities.setCapability("appActivity", ".ContactManager");
driver = new AndroidDriver<>(new URL("http://192.168.0.22:4723/wd/hub"), capabilities);
}
代码如上:
怎么我的总是报错,请指教
info: [debug] Error: Could not find a connected Android device.
at [object Object].ADB.getDevicesWithRetry (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-adb\lib\adb.js:606:15)
at [object Object].androidCommon.prepareActiveDevice (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:400:12)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:326:26)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:607:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:246:17
at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:146:13)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:157:25
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:248:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:612:34
at [object Object].androidCommon.ensureDeviceLocale (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:371:45)
at [object Object].androidCommon.prepareEmulator (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:364:10)
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:325:26)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:607:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:246:17
at iterate (C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:146:13)
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:157:25
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:248:21
at C:\Program Files (x86)\Appium\node_modules\appium\node_modules\async\lib\async.js:612:34
at [object Object]. (C:\Program Files (x86)\Appium\node_modules\appium\lib\devices\android\android-common.js:344:9)
at Object.oncomplete (fs.js:107:15)
info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not find a connected Android device.)","origValue":"Could not find a connected Android device."},"sessionId":null}
info: