如果你着急只是想隔离环境 那不用另一个服务器 你直接先弄两个 Tomcat 环境不就行了么
收益匪浅,另外想说大佬例子中的小伙伴写的关于 Jenkins 的 blog 发出来了吗,最近开始跳到这个坑里了
#11 楼 @neyo import time
import os from selenium import webdriver
import os from selenium.webdriver.remote.command
time.sleep(5)
desired_caps={}
desired_caps['platformName'] ='Android'
desired_caps['version']='4.3.1'
desired_caps['deviceName']='Android emulator-zq1:5554'
desired_caps['appPackage']='com.android.calculator2'
desired_caps['appActivity']='.Calculator'
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
driver.find_element_by_id("com.android.calculator2:id/digit1").click()
driver.find_element_by_id("com.android.calculator2:id/plus").click()
driver.find_element_by_id("com.android.calculator2:id/digit2").click()
driver.find_element_by_id("com.android.calculator2:id/equal").click()
driver.quit()
这样吗==
继续求助下
Checking if an update is available
Update available to new version 1.3.4.2
Starting Node Server
info: Welcome to Appium v1.3.4 (REV c8c79a85fbd6870cd6fc3d66d038a115ebe22efe)
info: Appium REST http interface listener started on 127.0.0.1:4723
info: [debug] Non-default server args: {"address":"127.0.0.1","logNoColors":true,"avd":"zq1","platformName":"Android","platformVersion":"18","automationName":"Appium"}
info: Console LogLevel: debug
info: --> POST /wd/hub/session {"requiredCapabilities":{},"desiredCapabilities":{"platformVersion":"4.3.1","deviceName":"Android Emulator","platformName":"Android","appActivity":".Calculator","appPackage":"com.android.calculator2"}}
info: Client User-Agent string: Python-urllib/2.7
info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device
info: [debug] Creating new appium session dc861be2-d7df-4282-95b7-2bdc34bba51c
info: Starting android appium
info: [debug] Getting Java version
info: Java version is: 1.8.0_101
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: [debug] Checking whether adb is present
info: [debug] Using adb from D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe
info: [debug] Trying to find zq1 emulator
info: [debug] Getting connected emulators
info: [debug] Getting connected devices...
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" devices
info: [debug] 1 device(s) connected
info: [debug] 1 emulator(s) connected
info: [debug] Sending telnet command to device: avd name
info: [debug] Getting running emulator port
info: [debug] Socket connection to device created
info: [debug] Socket connection to device ready
info: [debug] Telnet command got response: zq1
info: [debug] Found emulator zq1 in port 5554
info: [debug] Setting device id to emulator-5554
info: [debug] Did not launch AVD because it was already running.
info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 wait-for-device
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 shell "echo 'ready'"
info: [debug] Starting logcat capture
warn: No app capability, can't parse package/activity
info: [debug] Getting device API level
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 18
info: Device API level is: 18
info: [debug] Apk doesn't exist locally
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 shell "rm -rf /data/local/tmp/strings.json"
info: [debug] Not uninstalling app since server not started with --full-reset
info: [debug] Skipping install since we launched with a package instead of an app path
info: [debug] Forwarding system:4724 to device:4724
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 forward tcp:4724 tcp:4724
info: [debug] Pushing appium bootstrap to device...
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 push "C:\Program Files (x86)\Appium\node_modules\appium\build\android_bootstrap\AppiumBootstrap.jar" /data/local/tmp/
info: [debug] Pushing settings apk to device...
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 install "C:\Program Files (x86)\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
info: [debug] Pushing unlock helper app to device...
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
info: Starting App
info: [debug] Attempting to kill all 'uiautomator' processes
info: [debug] Getting all processes with 'uiautomator'
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 shell "ps 'uiautomator'"
info: [debug] No matching processes found
info: [debug] Running bootstrap
info: [debug] spawning: D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe -s emulator-5554 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
info: [debug] Waking up device if it's not alive
info: [debug] Pushing command to appium work queue: ["wake",{}]
info: [debug] [BOOTSTRAP] [debug] Loading json...
info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
info: [debug] [BOOTSTRAP] [debug] Client connected
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: wake
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":true,"status":0}
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 shell "dumpsys window"
info: [debug] Screen already unlocked, continuing.
info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data","status":0}
info: [debug] dataDir set to: /data
info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":false,"status":0}
info: [debug] Getting device API level
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 shell "getprop ro.build.version.sdk"
info: [debug] Device is at API Level 18
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.android.calculator2/.Calculator"
info: [debug] Waiting for pkg "com.android.calculator2" and activity ".Calculator" to be focused
info: [debug] Getting focused package and activity
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 shell "dumpsys window windows"
info: [debug] Getting focused package and activity
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 shell "dumpsys window windows"
info: [debug] Device launched! Ready for commands
info: [debug] Setting command timeout to the default of 60 secs
info: [debug] Appium session started with sessionId dc861be2-d7df-4282-95b7-2bdc34bba51c
info: <-- POST /wd/hub/session 303 40407.543 ms - 9
info: --> GET /wd/hub/session/dc861be2-d7df-4282-95b7-2bdc34bba51c {}
info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.3.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformVersion":"4.3.1","deviceName":"Android Emulator","platformName":"Android","appActivity":".Calculator","appPackage":"com.android.calculator2"},"deviceName":"Android Emulator","platformName":"Android","appActivity":".Calculator","appPackage":"com.android.calculator2"},"sessionId":"dc861be2-d7df-4282-95b7-2bdc34bba51c"}
info: <-- GET /wd/hub/session/dc861be2-d7df-4282-95b7-2bdc34bba51c 200 2.313 ms - 603 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"4.3.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformVersion":"4.3.1","deviceName":"Android Emulator","platformName":"Android","appActivity":".Calculator","appPackage":"com.android.calculator2"},"deviceName":"Android Emulator","platformName":"Android","appActivity":".Calculator","appPackage":"com.android.calculator2"},"sessionId":"dc861be2-d7df-4282-95b7-2bdc34bba51c"}
info: --> POST /wd/hub/session/dc861be2-d7df-4282-95b7-2bdc34bba51c/element {"using":"id","sessionId":"dc861be2-d7df-4282-95b7-2bdc34bba51c","value":"com.android.calculator:id/digit1"}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.android.calculator:id/digit1","context":"","multiple":false}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.android.calculator:id/digit1","context":"","multiple":false}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding com.android.calculator:id/digit1 using ID with the contextId: multiple: false
info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.android.calculator:id/digit1]
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"No element found","status":7}
info: [debug] Condition unmet after 4887ms. Timing out.
info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"No element found"},"sessionId":"dc861be2-d7df-4282-95b7-2bdc34bba51c"}
info: <-- POST /wd/hub/session/dc861be2-d7df-4282-95b7-2bdc34bba51c/element 500 4888.818 ms - 195
info: [debug] Didn't get a new command in 60 secs, shutting down...
info: Shutting down appium session
info: [debug] Pressing the HOME button
info: [debug] executing cmd: "D:\Program Files (x86)\android-sdk_r24.4.1-windows\android-sdk-windows\platform-tools\adb.exe" -s emulator-5554 shell "input keyevent 3"
info: [debug] Stopping logcat capture
info: [debug] Logcat terminated with code null, signal SIGTERM
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"OK, shutting down","status":0}
info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
info: [debug] [BOOTSTRAP] [debug] Closed client connection
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
info: [debug] [UIAUTOMATOR STDOUT] Time: 75.818
info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
info: [debug] UiAutomator shut down normally
info: [debug] Cleaning up android objects
info: [debug] Cleaning up appium session
info: [debug] We shut down because no new commands came in
为什么发出来这么乱了。。。