前言用appium切換webview的時(shí)候報(bào)chrome和chromedriver版本的問題:session not created exception: Chrome version must be >= 58.0.3029.0 運(yùn)行環(huán)境: 遇到問題1.當(dāng)執(zhí)行switch_to.context('WEBVIEW_NAME’)這句代碼的時(shí)候,會(huì)報(bào)chrome瀏覽器和chromedriver不匹配,,代碼報(bào)錯(cuò)信息如下: selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: session not created exception: Chrome version must be >= 58.0.3029.0
(Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64) 2.查看appium的日志,,很顯然是因?yàn)榘姹咎?hào)不匹配導(dǎo)致的 {"sessionId":"54f24f2451884a7fdcc64fc6480c4a91","status":33,"value":{"message":"session not created exception: Chrome version must be >= 58.0.3029.0\n (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64)"}}
[Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM
[Chromedriver] Changed state to 'stopped'
[Chromedriver] Unable to automate Chrome version because it is too old for this version of Chromedriver.
[Chromedriver] Please see 'https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/chromedriver.md'
[Chromedriver] Error: session not created exception: Chrome version must be >= 58.0.3029.0 3.那么問題來了,,這個(gè)chrome版本到底是手機(jī)上chrome瀏覽器版本還是電腦上chrome瀏覽器版本,,還是哪里的版本號(hào)呢,?這個(gè)chromedriver又是哪的驅(qū)動(dòng)版本? 查看webview版本號(hào)1.以微信為例,,webview的版本號(hào)可以用chrome瀏覽器查看到,,由于微信用的是x5內(nèi)核,跟其他app不太一樣,,這里需要先開啟微信的debug模式 開啟微信debug模式:在微信聊天界面輸入:debugx5.qq.com,如何勾選”打開TBS內(nèi)核Inspector調(diào)試功能 2.查看微信里面webview版本,,直接在電腦chrome瀏覽器輸入:chrome://inspect/#devices chromedrive下載1.找到webview的chrome版本號(hào)了,,接下來下載對應(yīng)的chromedriver驅(qū)動(dòng)包就可以了,57的webview對應(yīng)2.28驅(qū)動(dòng) 2.chromedriver下載后應(yīng)該放哪呢,?首先找到報(bào)錯(cuò)里面的chromedriver=2.30.477700 版本是從哪里來的,,替換掉就可以了。查找路徑:\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win 找到后雙擊就能顯示版本號(hào),,chromedriver=2.30.477700也就是報(bào)錯(cuò)里面看到的 備注:版本不一樣,,路徑可能不太一樣,自己搜索:appium-chromedriver 3.把剛才下載2.28版本的chromedriver.exe替換掉這個(gè)2.30版本就可以了 |
|