試圖使用appium
打開android瀏覽器。我使用genymotion
爲Android設備模擬器,並寫了下面的代碼..無法使用模擬器上的Appium或Real設備打開Android Browser
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName","Android Emulator");
capabilities.setCapability("browserName", "Browser");
capabilities.setCapability("platformVersion", "4.4");
capabilities.setCapability("Android", true);
Driver_ST = new RemoteWebDriver(new URL("http://URL:4723/wd/hub"), capabilities);
代碼執行後,如果我看到appium
以下錯誤出現:
>info: [debug] [BOOTSTRAP] [debug] Returning result: {"value":"\/data","status":0}
> info: [debug] dataDir set to: /data
> info: [debug] Creating Chrome session
> info: [debug] Set chromedriver binary as: D:\android\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
> info: [debug] Ensuring Chromedriver exists
> info: [debug] 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 %b))
> info: [debug] No old chromedrivers seemed to exist
> info: [debug] Spawning chromedriver with: D:\android\Appium\node_modules\appium\build\chromedriver\windows\chromedriver.exe
> info: [debug] [CHROMEDRIVER] Starting ChromeDriver (v2.10.267521) on port 9515
> Only local connections are allowed.
> info: [debug] Making http request with opts:
{"sessionId":null,"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.browser","androidActivity":"com.android.browser.BrowserActivity","androidDeviceSerial"}}}}
> error: Chromedriver create session did not work. Status was 200 and body was {"sessionId":"b6aa64e8f25541d3513243792337a1e7","status":13,"value":{"message":"unknown error: Chrome version must be >= 33.0.1750.0\n (Driver info: chromedriver=2.10.267521,platform=Windows NT 6.3 x86_64)"}}
> info: [debug] Cleaning up appium session
> error: Failed to start an Appium session, err was: Error: Did not get session redirect from Chromedriver
> info: [debug] Error: Did not get session redirect from Chromedriver
> at null.<anonymous> (D:\android\Appium\node_modules\appium\lib\devices\android\chromedriver.js:222:12)
> at Request._callback (D:\android\Appium\node_modules\appium\lib\devices\common.js:121:5)
> at Request.self.callback (D:\android\Appium\node_modules\appium\node_modules\request\request.js:121:22)
> at Request.EventEmitter.emit (events.js:98:17)
> at Request.<anonymous> (D:\android\Appium\node_modules\appium\node_modules\request\request.js:985:14)
> at Request.EventEmitter.emit (events.js:117:20)
> at IncomingMessage.<anonymous> (D:\android\Appium\node_modules\appium\node_modules\request\request.js:936:12)
> at IncomingMessage.EventEmitter.emit (events.js:117:20)
> at _stream_readable.js:920:16
> at process._tickDomainCallback (node.js:459:13)
> info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Did not get session redirect from Chromedriver)","origValue":"Did not get session redirect from Chromedriver"},"sessionId":null}
> info: <-- POST /wd/hub/session 500 28735.979 ms - 214
那麼,爲什麼這是給我的錯誤chromedriver
的會話無法創建,但我試圖打開Android瀏覽器。
請幫忙。我是否缺少任何功能或需要安裝的驅動程序?
您使用的是什麼版本'chromedriver'? – Saifur
我正在使用更新chrome驅動程序,並能夠使用appium在真實設備上打開chrome瀏覽器。但不是真正的設備或模擬器上的Android瀏覽器。 – avni
avni,你有沒有得到任何解決你的問題。我也在同一艘船上航行。目前尚未得到任何解決方案。如果您有任何解決方案,請幫助我。 – Uday