appium+python自動化41-切換webview時候報chromedriver版本問題

來源:互聯網
上載者:User

標籤:while   https   pts   sig   debug模式   pytho   info   tomat   bug   

前言

用appium切換webview的時候報chrome和chromedriver版本的問題:session not created exception: Chrome version must be >= 58.0.3029.0
(Driver info: chromedriver=2.30.477700 )

運行環境:
android 7.0
appium 1.7.1
appium裡面chromedriver 2.28
webview版本 57.0

遇到問題

1.當執行switch_to.context(‘WEBVIEW_NAME‘)這句代碼的時候,會報chrome瀏覽器和chromedriver不匹配,代碼報錯資訊如下:

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的日誌,很顯然是因為版本號碼不匹配導致的

{"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.那麼問題來了,這個chrome版本到底是手機上chrome瀏覽器版本還是電腦上chrome瀏覽器版本,還是哪裡的版本號碼呢?這個chromedriver又是哪的驅動版本?

查看webview版本號碼

1.以為例,webview的版本號碼可以用chrome瀏覽器查看到,由於用的是x5核心,跟其他app不太一樣,這裡需要先開啟的debug模式

開啟debug模式:在聊天介面輸入:debugx5.qq.com,如何勾選"開啟TBS核心Inspector調試功能

2.查看裡面webview版本,直接在電腦chrome瀏覽器輸入:chrome://inspect/#devices
再開啟的公眾號頁面,重新整理瀏覽器頁面,就會出現webview版本號碼57.0

chromedrive下載

1.找到webview的chrome版本號碼了,接下來下載對應的chromedriver驅動包就可以了,57的webview對應2.28驅動
:chromedriver版本下載

2.chromedriver下載後應該放哪呢?首先找到報錯裡面的chromedriver=2.30.477700 版本是從哪裡來的,替換掉就可以了。尋找路徑:\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win

找到後雙擊就能顯示版本號碼,chromedriver=2.30.477700也就是報錯裡面看到的

備忘:版本不一樣,路徑可能不太一樣,自己搜尋:appium-chromedriver

3.把剛才下載2.28版本的chromedriver.exe替換掉這個2.30版本就可以了

appium+python自動化41-切換webview時候報chromedriver版本問題

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.