Selenium webdriver Webdriver单击不适用于Android设备上的chrome

Selenium webdriver Webdriver单击不适用于Android设备上的chrome,selenium-webdriver,appium,selenium-chromedriver,Selenium Webdriver,Appium,Selenium Chromedriver,我正在尝试使用SeleniumWebDriver和appium在android设备上自动化web应用程序。但是我被卡住了,因为click()似乎不适用于Android设备上的chrome浏览器,同样适用于桌面上的chrome浏览器 请参阅附加的测试代码,以在gmail.com和appium控制台日志上重现该问题。不确定这是chromeDriver的问题还是需要以其他方式实现 代码 应用程序日志 > info: --> POST /wd/hub/session {"desiredCap

我正在尝试使用SeleniumWebDriver和appium在android设备上自动化web应用程序。但是我被卡住了,因为click()似乎不适用于Android设备上的chrome浏览器,同样适用于桌面上的chrome浏览器

请参阅附加的测试代码,以在gmail.com和appium控制台日志上重现该问题。不确定这是chromeDriver的问题还是需要以其他方式实现

代码

应用程序日志

> info: --> POST /wd/hub/session {"desiredCapabilities":{"newCommandTimeout":60,"browserName":"chrome","platformName":"Android","deviceName":"Android"}}
> info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_60)
> info: Set mode: Proxying straight through to Chromedriver
> info: [debug] Looks like we want chrome on android
> info: [debug] Creating new appium session b061da72-cfb4-4d06-8595-b9fe52439d37
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from D:\eGain\Automation\Android\sdk\platform-tools\adb.exe
> 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:\eGain\Automation\Android\sdk\platform-tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: Found device a33124a7
> info: [debug] Setting device id to a33124a7
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 wait-for-device
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "echo 'ready'"
> info: [debug] Starting logcat capture
> info: [debug] Pushing unlock helper app to device...
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "dumpsys window"
> info: Unlocking screen
> info: [debug] Screen is locked, trying to unlock
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 23
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.unlock/.Unlock"
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "dumpsys window"
> info: [debug] Screen is unlocked, continuing
> info: [debug] Forwarding system:4724 to device:4724
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 forward tcp:4724 tcp:4724
> info: [debug] Pushing appium bootstrap to device...
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 push "C:\\Program Files (x86)\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
> info: Starting App
> info: [debug] Attempting to kill all 'uiautomator' processes
> info: [debug] Getting all processes with 'uiautomator'
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "ps 'uiautomator'"
> info: [debug] No matching processes found
> info: [debug] Running bootstrap
> info: [debug] spawning: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.android.chrome -e disableAndroidWatchers false
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> 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] [BOOTSTRAP] [debug] Loading json...
> info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
> info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
> info: [debug] [BOOTSTRAP] [debug] Client connected
> 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] dataDir set to: /data/local/tmp
> info: Chromedriver: Changed state to 'starting'
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\/local\/tmp"}
> info: Chromedriver: Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
> info: Chromedriver: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %a))
> info: Chromedriver: No old chromedrivers seemed to exist
> info: Chromedriver: Spawning chromedriver with: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=9515
> info: Chromedriver: [STDOUT] Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 9515
> Only local connections are allowed.
> info: JSONWP Proxy: Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with no body
> info: JSONWP Proxy: Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"10.0.10586\"}}}"
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"a33124a7"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedr...
> info: Chromedriver: Changed state to 'online'
> info: [debug] Overriding session id with "0ebf4514a9760982649f45ce431656e8"
> info: [debug] Device launched! Ready for commands
> info: [debug] Setting command timeout to 60 secs
> info: [debug] Appium session started with sessionId 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session 303 18667.504 ms - 70 
> info: --> GET /wd/hub/session/0ebf4514a9760982649f45ce431656e8 {}
> info: JSONWP Proxy: Proxying [GET /wd/hub/session/0ebf4514a9760982649f45ce431656e8] to [GET http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8] with body: {}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedr...
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- GET /wd/hub/session/0ebf4514a9760982649f45ce431656e8 200 11.638 ms - 606 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/url {"url":"http://gmail.com"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/url] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/url] with body: {"url":"http://gmail.com"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":null}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/url 200 2374.402 ms - 72 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element {"using":"id","value":"Email"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] with body: {"using":"id","value":"Email"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"ELEMENT":"0.46630814854548563-1"}}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element 200 154.429 ms - 103 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value {"id":"0.46630814854548563-1","value":["test"]}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value] with body: {"id":"0.46630814854548563-1","value":["test"]}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":null}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value 200 300.313 ms - 72 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element {"using":"id","value":"next"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] with body: {"using":"id","value":"next"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"ELEMENT":"0.46630814854548563-2"}}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element 200 160.963 ms - 103 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click {"id":"0.46630814854548563-2"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click] with body: {"id":"0.46630814854548563-2"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":null}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click 200 350.330 ms - 72 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element {"using":"id","value":"Passwd"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] with body: {"using":"id","value":"Passwd"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":7,"value":{"message":"no such element: Unable to locate element: {\"method\":\"id\",\"selector\":\"Passwd\"}\n  (Session info: chrome=52.0.2...
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element 200 227.600 ms - 331 
> info: [debug] Didn't get a new command in 60 secs, shutting down...
> info: Shutting down appium session
> info: Chromedriver: Changed state to 'stopping'
> info: JSONWP Proxy: Proxying [DELETE /] to [DELETE http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8] with no body
> info: JSONWP Proxy: Got response with status 200: "{\"sessionId\":\"0ebf4514a9760982649f45ce431656e8\",\"status\":0,\"value\":null}"
> info: Chromedriver: Changed state to 'stopped'
> 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: {"status":0,"value":"OK, shutting down"}
> info: [debug] [BOOTSTRAP] [debug] Closed client connection
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> 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: 76.13
> info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
> info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
> info: [debug] UiAutomator shut down normally
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "am force-stop com.android.chrome"
> info: [debug] Stopping logcat capture
> info: [debug] Logcat terminated with code null, signal SIGTERM
> info: [debug] Cleaning up appium session
> info: [debug] We shut down because no new commands came in
>信息:-->POST/wd/hub/session{“desiredCapabilities”:{“newCommandTimeout”:60,“browserName”:“chrome”,“platformName”:“Android”,“deviceName”:“Android”}
>信息:客户端用户代理字符串:Apache HttpClient/4.5.1(Java/1.8.0_60)
>信息:设置模式:直接代理到Chromedriver
>信息:[调试]看起来我们想要android上的chrome
>信息:[调试]正在创建新的应用程序会话b061da72-cfb4-4d06-8595-b9fe52439d37
>信息:[调试]检查adb是否存在
>信息:[调试]从D:\eGain\Automation\Android\sdk\platform tools\adb.exe使用adb
>信息:[调试]是否使用快速重置?真的
>信息:[调试]正在为会话准备设备
>信息:[调试]不检查应用程序是否存在,因为我们假设它已经在设备上
>信息:检索设备
>信息:[调试]正在尝试查找已连接的android设备
>信息:[调试]正在获取连接的设备。。。
>信息:[调试]正在执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe设备
>信息:[调试]已连接1个设备
>信息:找到设备a33124a7
>信息:[调试]将设备id设置为a33124a7
>信息:[调试]等待设备准备就绪并响应shell命令(超时=5)
>信息:[调试]正在执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7等待设备
>信息:[调试]正在执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7 shell“echo'ready'”
>信息:[调试]正在启动logcat捕获
>信息:[调试]正在将解锁帮助程序应用程序推送到设备。。。
>信息:[调试]正在执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7安装“C:\Program Files(x86)\Appium\node\u modules\Appium\build\unlock\u apk\unlock\u apk-debug.apk”
>信息:[调试]正在执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7 shell“dumpsys窗口”
>信息:解锁屏幕
>信息:[调试]屏幕已锁定,正在尝试解锁
>信息:[调试]正在获取设备API级别
>信息:[调试]正在执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7 shell“getprop ro.build.version.sdk”
>信息:[调试]设备处于API级别23
>信息:[调试]执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7 shell“am start-s-a Android.intent.action.MAIN-c Android.intent.category.LAUNCHER-f 0x10200000-n io.appium.unlock/.unlock”
>信息:[调试]正在执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7 shell“dumpsys窗口”
>信息:[调试]屏幕已解锁,继续
>信息:[调试]将系统:4724转发到设备:4724
>信息:[调试]正在执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7转发tcp:4724 tcp:4724
>信息:[调试]正在将appium引导程序推送到设备。。。
>信息:[调试]执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7 push“C:\\Program Files(x86)\\Appium\\node\u modules\\Appium\\build\\Android\u bootstrap\\AppiumBootstrap.jar”/data/local/tmp/
>信息:启动应用程序
>信息:[调试]正在尝试终止所有“uiautomator”进程
>信息:[调试]使用“uiautomator”获取所有进程
>信息:[调试]正在执行cmd:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7 shell“ps'uiautomator'”
>信息:[调试]未找到匹配的进程
>信息:[调试]正在运行引导
>信息:[调试]生成:D:\eGain\Automation\Android\sdk\platform tools\adb.exe-s a33124a7 shell uiautomator runtest AppiumBootstrap.jar-c io.appium.Android.bootstrap.bootstrap-e pkg com.Android.chrome-e disableAndroidWatchers false
>信息:[debug][UIAUTOMATOR STDOUT]检测\u状态:numtests=1
>信息:[调试][UIAUTOMATOR标准输出]检测\u状态:流=
>信息:[debug][UIAUTOMATOR STDOUT]io.appium.android.bootstrap.bootstrap:
>信息:[调试][UIAUTOMATOR标准输出]检测\u状态:id=UiAutomatorTestRunner
>信息:[debug][UIAUTOMATOR STDOUT]INSTRUMENTATION\u状态:test=testRunServer
>信息:[debug][UIAUTOMATOR STDOUT]检测\u状态:class=io.appium.android.bootstrap.bootstrap
>信息:[调试][UIAUTOMATOR标准输出]检测\u状态:当前=1
>信息:[调试][UIAUTOMATOR标准输出]检测\u状态\u代码:1
>信息:[debug][BOOTSTRAP][debug]端口4724上已打开套接字
>信息:[调试][引导][调试]Appium套接字服务器就绪
>信息:[调试][引导][调试]正在加载json。。。
>信息:[调试][引导][调试]已注册的崩溃监视程序。
>信息:[调试]将命令推送到appium工作队列:[“getDataDir”,{}]
>信息:[调试][引导][调试]客户端已连接
>信息:[debug][BOOTSTRAP][debug]已从客户端获取数据:{“cmd”:“action”,“action”:“getDataDir”,“params”:{}
>信息:[debug][BOOTSTRAP][debug]获取了类型为ACTION的命令
>信息:[debug][BOOTSTRAP][debug]获取了命令操作:getDataDir
>信息:[调试]数据目录设置为:/data/local/tmp
>信息:Chromedriver:已将状态更改为“启动”
>信息:[debug][BOOTSTRAP][debug]返回结果:{“状态”:0,“值”:“\/data\/local\/tmp”}
>信息:Chromedriver:将Chromedriver二进制文件设置为:C:\Program Files(x86)\Appium\node\U modules\Appium\node\U modules\Appium Chromedriver\Chromedriver\win\Chromedriver.exe
>信息:Chromedriver:删除所有旧Chromedriver,运行:FOR/F“usebackq令牌=5”%a in(`netstat-nao^ | findstr/R/C:`9515`)do(FOR/F“usebackq”%b in(`TASKLIST/FI“PID eq%a”^ findstr/I Chromedriver.exe`)do(如果不是%b==”TASKKILL/F/PID%a))
>信息:Chromedriver:没有旧的Chromedriver se
> info: --> POST /wd/hub/session {"desiredCapabilities":{"newCommandTimeout":60,"browserName":"chrome","platformName":"Android","deviceName":"Android"}}
> info: Client User-Agent string: Apache-HttpClient/4.5.1 (Java/1.8.0_60)
> info: Set mode: Proxying straight through to Chromedriver
> info: [debug] Looks like we want chrome on android
> info: [debug] Creating new appium session b061da72-cfb4-4d06-8595-b9fe52439d37
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from D:\eGain\Automation\Android\sdk\platform-tools\adb.exe
> 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:\eGain\Automation\Android\sdk\platform-tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: Found device a33124a7
> info: [debug] Setting device id to a33124a7
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 wait-for-device
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "echo 'ready'"
> info: [debug] Starting logcat capture
> info: [debug] Pushing unlock helper app to device...
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 install "C:\Program Files (x86)\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "dumpsys window"
> info: Unlocking screen
> info: [debug] Screen is locked, trying to unlock
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 23
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n io.appium.unlock/.Unlock"
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "dumpsys window"
> info: [debug] Screen is unlocked, continuing
> info: [debug] Forwarding system:4724 to device:4724
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 forward tcp:4724 tcp:4724
> info: [debug] Pushing appium bootstrap to device...
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 push "C:\\Program Files (x86)\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
> info: Starting App
> info: [debug] Attempting to kill all 'uiautomator' processes
> info: [debug] Getting all processes with 'uiautomator'
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "ps 'uiautomator'"
> info: [debug] No matching processes found
> info: [debug] Running bootstrap
> info: [debug] spawning: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.android.chrome -e disableAndroidWatchers false
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> 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] [BOOTSTRAP] [debug] Loading json...
> info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
> info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
> info: [debug] [BOOTSTRAP] [debug] Client connected
> 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] dataDir set to: /data/local/tmp
> info: Chromedriver: Changed state to 'starting'
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\/local\/tmp"}
> info: Chromedriver: Set chromedriver binary as: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe
> info: Chromedriver: Killing any old chromedrivers, running: FOR /F "usebackq tokens=5" %a in (`netstat -nao ^| findstr /R /C:"9515 "`) do (FOR /F "usebackq" %b in (`TASKLIST /FI "PID eq %a" ^| findstr /I chromedriver.exe`) do (IF NOT %b=="" TASKKILL /F /PID %a))
> info: Chromedriver: No old chromedrivers seemed to exist
> info: Chromedriver: Spawning chromedriver with: C:\Program Files (x86)\Appium\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=9515
> info: Chromedriver: [STDOUT] Starting ChromeDriver 2.23.409699 (49b0fa931cda1caad0ae15b7d1b68004acd05129) on port 9515
> Only local connections are allowed.
> info: JSONWP Proxy: Proxying [GET /status] to [GET http://127.0.0.1:9515/wd/hub/status] with no body
> info: JSONWP Proxy: Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"10.0.10586\"}}}"
> info: JSONWP Proxy: Proxying [POST /session] to [POST http://127.0.0.1:9515/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"a33124a7"}}}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedr...
> info: Chromedriver: Changed state to 'online'
> info: [debug] Overriding session id with "0ebf4514a9760982649f45ce431656e8"
> info: [debug] Device launched! Ready for commands
> info: [debug] Setting command timeout to 60 secs
> info: [debug] Appium session started with sessionId 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session 303 18667.504 ms - 70 
> info: --> GET /wd/hub/session/0ebf4514a9760982649f45ce431656e8 {}
> info: JSONWP Proxy: Proxying [GET /wd/hub/session/0ebf4514a9760982649f45ce431656e8] to [GET http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8] with body: {}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"acceptSslCerts":true,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"browserName":"chrome","chrome":{"chromedr...
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- GET /wd/hub/session/0ebf4514a9760982649f45ce431656e8 200 11.638 ms - 606 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/url {"url":"http://gmail.com"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/url] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/url] with body: {"url":"http://gmail.com"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":null}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/url 200 2374.402 ms - 72 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element {"using":"id","value":"Email"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] with body: {"using":"id","value":"Email"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"ELEMENT":"0.46630814854548563-1"}}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element 200 154.429 ms - 103 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value {"id":"0.46630814854548563-1","value":["test"]}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value] with body: {"id":"0.46630814854548563-1","value":["test"]}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":null}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-1/value 200 300.313 ms - 72 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element {"using":"id","value":"next"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] with body: {"using":"id","value":"next"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":{"ELEMENT":"0.46630814854548563-2"}}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element 200 160.963 ms - 103 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click {"id":"0.46630814854548563-2"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click] with body: {"id":"0.46630814854548563-2"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":0,"value":null}
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element/0.46630814854548563-2/click 200 350.330 ms - 72 
> info: --> POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element {"using":"id","value":"Passwd"}
> info: JSONWP Proxy: Proxying [POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] to [POST http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8/element] with body: {"using":"id","value":"Passwd"}
> info: JSONWP Proxy: Got response with status 200: {"sessionId":"0ebf4514a9760982649f45ce431656e8","status":7,"value":{"message":"no such element: Unable to locate element: {\"method\":\"id\",\"selector\":\"Passwd\"}\n  (Session info: chrome=52.0.2...
> info: JSONWP Proxy: Replacing sessionId 0ebf4514a9760982649f45ce431656e8 with 0ebf4514a9760982649f45ce431656e8
> info: <-- POST /wd/hub/session/0ebf4514a9760982649f45ce431656e8/element 200 227.600 ms - 331 
> info: [debug] Didn't get a new command in 60 secs, shutting down...
> info: Shutting down appium session
> info: Chromedriver: Changed state to 'stopping'
> info: JSONWP Proxy: Proxying [DELETE /] to [DELETE http://127.0.0.1:9515/wd/hub/session/0ebf4514a9760982649f45ce431656e8] with no body
> info: JSONWP Proxy: Got response with status 200: "{\"sessionId\":\"0ebf4514a9760982649f45ce431656e8\",\"status\":0,\"value\":null}"
> info: Chromedriver: Changed state to 'stopped'
> 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: {"status":0,"value":"OK, shutting down"}
> info: [debug] [BOOTSTRAP] [debug] Closed client connection
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> 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: 76.13
> info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
> info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
> info: [debug] UiAutomator shut down normally
> info: [debug] executing cmd: D:\eGain\Automation\Android\sdk\platform-tools\adb.exe -s a33124a7 shell "am force-stop com.android.chrome"
> info: [debug] Stopping logcat capture
> info: [debug] Logcat terminated with code null, signal SIGTERM
> info: [debug] Cleaning up appium session
> info: [debug] We shut down because no new commands came in
capabilities.setCapability("deviceName", "YOUR-DEVICE-NAME"); // such as GalaxyS6
capabilities.setCapability("browserName", "Chrome"); // its Chrome instead of chrome
driver.hideKeyboard();
driver.findElement(By.id("Passwd")).sendKeys("test");
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//android.widget.EditText[@resource-id='Passwd']")));
public void setUp() throws Exception {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Galaxy");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("appPackage", "com.android.chrome");
capabilities.setCapability("appActivity","com.google.android.apps.chrome.ChromeTabbedActivity");
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
public class TestMobileBrowser {

public DesiredCapabilities capabilities;
public AppiumDriver driver;
@BeforeTest
public void beforeTest() throws Exception{

capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "Android");
capabilities.setCapability("platformName", "Android");
capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
capabilities.setCapability("platformVersion", "5.0.2");
capabilities.setCapability("appPackage", "com.android.chrome");
capabilities.setCapability("appActivity","com.google.android.apps.chrome.ChromeTabbedActivity");
driver= new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}

@Test
public void test(){
driver.get("http://gmail.com");
driver.findElement(By.id("Email")).sendKeys("test");
Thread.sleep(30000);
driver.findElement(By.id("next")).click();  
driver.findElement(By.id("Passwd")).sendKeys("test");
driver.findElement(By.id("signIn")).click();    
}

}