我試圖自動化Android設備上的Android Chrome瀏覽器(不僅僅是一個Web瀏覽器或其他瀏覽器,但Chrome瀏覽器)。我認爲這是可能的,通過以下鏈接https://sites.google.com/a/chromium.org/chromedriver/getting-started/getting-started---android,但它自動化我的PC鉻瀏覽器。如何使用selenium或appium在android上自動化Chrome瀏覽器?
我也試過Appium,但日誌後沒有任何反應:
debug: executing: adb install C:\Users\hidden\Downloads\AppiumForWindows-0.14.2\
Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk
當我嘗試從瀏覽器訪問信息,我得到這個:
info: Responding to client with error: {"status":13,"value":{"message":"An unkno
wn server-side error occurred while processing the command.","origValue":"Did no
t successfully proxy server command"},"sessionId":"666c9e4f-7653-487a-b299-959d4
000ca79"}
我有chromedriver。 exe在我的環境變量PATH,整個日誌看起來像這樣:
info: Welcome to Appium v0.14.2
info: Appium REST http interface listener started on 127.0.0.1:5555
info - socket.io started
debug: Appium request initiated at /wd/hub/session
debug: Request received with params: {"desiredCapabilities":{"platform":"ANDROID
","app":"chrome","browserName":"android","browserConnectionEnabled":true,"app-pa
ckage":"com.android.chrome","device":"android","rotatable":true,"app-activity":"
com.google.android.apps.chrome.Main","takesScreenshot":true,"version":""}}
info: Looks like we want chrome on android
info: Creating new appium session 666c9e4f-7653-487a-b299-959d4000ca79
info: Ensuring Chromedriver exists
debug: Pushing unlock helper app to device...
debug: executing: adb install C:\Users\hidden\Downloads\AppiumForWindows-0.14.2\
Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk
warn: killed=false, code=1, signal=null
debug: Appium request initiated at /wd/hub/status
debug: Request received with params: {}
debug: Proxying command to 127.0.0.1:9515
info: Making http request with opts: {"url":"http://127.0.0.1:9515/wd/hub/status
","method":"GET"}
info: Responding to client with error: {"status":13,"value":{"message":"An unkno
wn server-side error occurred while processing the command.","origValue":"Did no
t successfully proxy server command"},"sessionId":"666c9e4f-7653-487a-b299-959d4
000ca79"}
GET /wd/hub/status 500 1014ms - 238b
POST /wd/hub/session 200 31311ms
謝謝。
是否啓用USB調試您的開發者選擇Android設備上? – Kinlan
是的,我有。我可以自動化selendroid瀏覽器就好了。我認爲它不可能使用硒自動化鉻瀏覽器。我最終創建了一個帶有webview的4.4項目,並使用工具工具將chrome pc工具連接到我的設備。 –
有趣的是,Chrome瀏覽器自動運行(我通過遙測技術完成)當然是可以的,但我沒有通過Selenium – Kinlan