环境:Windows XP
Appium 版本:0.15.0,exe 客户端
Android 版本:4.1 模拟器
测试代码:
public void setUp() throws Exception {
// set up appium
File classpathRoot = new File(System.getProperty("user.dir"));
File appDir = new File(classpathRoot, "libs");
File app = new File(appDir, "ContactManager.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("device","Selendroid");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "");
capabilities.setCapability(CapabilityType.VERSION, "4.1");
capabilities.setCapability(CapabilityType.PLATFORM, "Windows");
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("app-package", "com.example.android.contactmanager");
capabilities.setCapability("app-activity", ".ContactManager");
driver = new SwipeableWebDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}

错误日志:
info: Welcome to Appium v0.15.0 (REV a7b47d73a27074cc928cc5b325e5d4de1b6e5594)
info: Appium REST http interface listener started on 127.0.0.1:4723
info - socket.io started
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"platform":"MAC","a
pp":"Z:\Project\AppiumTest\libs\ContactManager.apk","browserName":"","app-pa
ckage":"com.example.android.contactmanager","device":"Selendroid","app-activity"
:".ContactManager","version":"4.1"}}
info: Using local app from desiredCaps: Z:\Project\AppiumTest\libs\ContactManage
r.apk
info: Creating new appium session 1ccc42ff-e003-4a4f-afb6-4ee277999d6c
info: Starting selendroid server
info: Checking whether selendroid is built yet
info: Selendroid server exists!
info: Preparing device for session
info: Checking whether app is actually present
info: Checking whether adb is present
info: [ADB] Using adb from D:\Program Files\Android\sdk\platform-tools\adb.exe
info: Trying to find a connected android device
info: [ADB] Getting connected devices...
debug: executing: "D:\Program Files\Android\sdk\platform-tools\adb.exe" devices
info: [ADB] 1 device(s) connected
info: Setting device id to emulator-5554
info: [ADB] Waiting for device to be ready and to respond to shell commands (tim
eout = 5)
debug: executing: "D:\Program Files\Android\sdk\platform-tools\adb.exe" -s emula
tor-5554 wait-for-device
debug: executing: "D:\Program Files\Android\sdk\platform-tools\adb.exe" -s emula
tor-5554 shell "echo 'ready'"
info: Starting logcat capture
info: Rebuilt selendroid apk exists, doing nothing
info: Rebuilt selendroid server already exists, no need to rebuild it with a new
manifest
info: Checking signed status of C:\Windows\Temp\selendroid.com.example.android.c
ontactmanager.apk
debug: Checking app cert for C:\Windows\Temp\selendroid.com.example.android.cont
actmanager.apk: java -jar "E:\Selenium\Appnium\Appium\node_modules\appium\lib\de
vices\android\helpers\verify.jar" "C:\Windows\Temp\selendroid.com.example.androi
d.contactmanager.apk"
info: Checking signed status of Z:\Project\AppiumTest\libs\ContactManager.apk
debug: Checking app cert for Z:\Project\AppiumTest\libs\ContactManager.apk: java
-jar "E:\Selenium\Appnium\Appium\node_modules\appium\lib\devices\android\helper
s\verify.jar" "Z:\Project\AppiumTest\libs\ContactManager.apk"
debug: App already signed.
debug: App already signed.
debug: Getting install status for com.example.android.contactmanager.selendroid
debug: executing: "D:\Program Files\Android\sdk\platform-tools\adb.exe" -s emula
tor-5554 shell "pm list packages -3 com.example.android.contactmanager.selendroi
d"
info: [ADB] App is installed
info: Rebuilt selendroid is already installed
debug: Not uninstalling app since server not started with --full-reset
info: MD5 for app is 4621b5c217c790d3e00fe3a441331c76
debug: executing: "D:\Program Files\Android\sdk\platform-tools\adb.exe" -s emula
tor-5554 shell "ls /data/local/tmp/4621b5c217c790d3e00fe3a441331c76.apk"
debug: Getting install status for com.example.android.contactmanager
debug: executing: "D:\Program Files\Android\sdk\platform-tools\adb.exe" -s emula
tor-5554 shell "pm list packages -3 com.example.android.contactmanager"
info: [ADB] App is installed
info: [ADB] Forwarding system:8080 to device:8080
debug: executing: "D:\Program Files\Android\sdk\platform-tools\adb.exe" -s emula
tor-5554 forward tcp:8080 tcp:8080
debug: Pushing unlock helper app to device...
debug: executing: "D:\Program Files\Android\sdk\platform-tools\adb.exe" -s emula
tor-5554 install E:\Selenium\Appnium\Appium\node_modules\appium\build\unlock_apk
\unlock_apk-debug.apk
debug: executing: "D:\Program Files\Android\sdk\platform-tools\adb.exe" -s emula
tor-5554 shell "dumpsys window"
info: Writing dumpsys output to E:\Selenium\Appnium\Appium\node_modules\appium.
dumpsys.log
debug: Screen already unlocked, continuing.
debug: executing: "D:\Program Files\Android\sdk\platform-tools\adb.exe" -s emula
tor-5554 shell "am instrument -e main_activity 'com.example.android.contactmanag
er.ContactManager' com.example.android.contactmanager.selendroid/io.selendroid.S
erverInstrumentation"
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Making http request with opts: {"url":"http://localhost:8080/wd/hub/status
","method":"GET"}
info: Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Waited 20 secs for sel
endroid server and it never showed up
info: Responding to client with error: {"status":33,"value":{"message":"A new se
ssion could not be created. (Original error: Waited 20 secs for selendroid serve
r and it never showed up)","origValue":"Waited 20 secs for selendroid server and
it never showed up"},"sessionId":null}
POST /wd/hub/session 500 29606ms - 268b
debug: Logcat terminated with code 0, signal null

这个错误是什么原因,实在搞不懂,官网看了下,windows 下解决不了?


↙↙↙阅读原文可查看相关链接,并与作者交流