Appium1.9 之 Chromedriver安装方式

1、在 appium 官网上下载安装后,下载的是1.7.1的版本,安装之后是1.9.1最新版本。

2、appium安装之后,会发现涉及到 浏览器相关的业务时(我使用的是chrome)会提示 “No Chromedriver found that can automate Chrome '62.0.3202'”。

 1 # -*- coding:utf-8 -*-
 2 '''
 3 Created on Sep 30, 2018
 4 
 5 @author: SaShuangYiBing
 6 
 7 Comment: 
 8 '''
 9 from appium import webdriver
10 desired_caps = {}        
11 desired_caps['platformName'] ='Android'        
12 desired_caps['platformVersion'] ='7.0'       
13 desired_caps['deviceName'] ='DIYTHYTCCQBIV47D'  
14 desired_caps['browserName'] = 'Chrome'     
15   
16 desired_caps["unicodeKeyboard"] ="True"        
17 desired_caps["resetKeyboard"] ="True"        
18 driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
19 
20 
21 print(driver.current_package)
22 print(driver.current_activity)
23 
24 
25 #输出错误如下:
26 Traceback (most recent call last):
27   File "D:\WorkSpace3\EXAMPLE\Appiu_ex\qwsa.py", line 18, in <module>
28     driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
29   File "C:\Program Files\Python36\lib\site-packages\appium\webdriver\webdriver.py", line 97, in __init__
30     super(WebDriver, self).__init__(command_executor, desired_capabilities, browser_profile, proxy, keep_alive)
31   File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
32     self.start_session(capabilities, browser_profile)
33   File "C:\Program Files\Python36\lib\site-packages\appium\webdriver\webdriver.py", line 136, in start_session
34     response = self.execute(RemoteCommand.NEW_SESSION, parameters)
35   File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
36     self.error_handler.check_response(response)
37   File "C:\Program Files\Python36\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
38     raise exception_class(message, screen, stacktrace)
39 selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome '62.0.3202'. See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md for more details.
View Code

 

3、按照错误提示提供的 github 链接去查看如何安装这个driver,发现使用 npm 命令进行安装。

4、打开命令行窗口,输入npm 提示命令无效,接下来就得要先安装某个软件才能支持这个命令,网上上查找一翻之后是要安装 Node.js,之前老的appium版本(v1.4左右)是会自带这个node.js的,新版本目前未发现。

5、前往 Node.js 官网下载跟系统匹配的版本进行安装,安装时一路点 Next 直到 Finish 即可。

6、重新打开命令窗口,输入 npm -v 会提示出版本号,如果未显示出版本号则可能是安装出问题,请将上面步骤重新跑一遍。 

7、然后查找浏览器的版本号,找到对应的chrmoedriver 版本号,匹配关系如下:

The following is a list of Chromedriver versions and their corresponding minimum Chrome version that is automatable:

VersionMinimum Chrome VersionLink to Chromedriver
2.42 68.0.3440.0 v2.42 (link)
2.41 67.0.3360.0 v2.41 (link)
2.40 66.0.3359.0 v2.40 (link)
2.39 66.0.3359.0 v2.39 (link)
2.38 65.0.3325.0 v2.38 (link)
2.37 64.0.3282.0 v2.37 (link)
2.36 63.0.3239.0 v2.36 (link)
2.35 62.0.3202.0 v2.35 (link)
2.34 61.0.3163.0 v2.34 (link)
2.33 60.0.3112.0 v2.33 (link)
2.32 59.0.3071.0 v2.32 (link)
2.31 58.0.3029.0 v2.31 (link)
2.30 58.0.3029.0 v2.30 (link)
2.29 57.0.2987.0 v2.29 (link)
2.28 55.0.2883.0 v2.28 (link)
2.27 54.0.2840.0 v2.27 (link)
2.26 53.0.2785.0 v2.26 (link)
2.25 53.0.2785.0 v2.25 (link)
2.24 52.0.2743.0 v2.24 (link)
2.23 51.0.2704.0 v2.23 (link)
2.22 49.0.2623.0 v2.22 (link)
2.21 46.0.2490.0 v2.21 (link)
2.20 43.0.2357.0 v2.20 (link)
2.19 43.0.2357.0 v2.19 (link)
2.18 43.0.2357.0 v2.18 (link)
2.17 42.0.2311.0 v2.17 (link)
2.16 42.0.2311.0 v2.16 (link)
2.15 40.0.2214.0 v2.15 (link)
2.14 39.0.2171.0 v2.14 (link)
2.13 38.0.2125.0 v2.13 (link)
2.12 36.0.1985.0 v2.12 (link)
2.11 36.0.1985.0 v2.11 (link)
2.10 33.0.1751.0 v2.10 (link)
2.9 31.0.1650.59 v2.9 (link)
2.8 30.0.1573.2 v2.8 (link)
2.7 30.0.1573.2 v2.7 (link)
2.6 29.0.1545.0 v2.6 (link)
2.5 29.0.1545.0 v2.5 (link)
2.4 29.0.1545.0 v2.4 (link)
2.3 28.0.1500.0 v2.3 (link)
2.2 27.0.1453.0 v2.2 (link)
2.1 27.0.1453.0 v2.1 (link)
2.0 27.0.1453.0 v2.0 (link)

上述chromedriver版本匹配及下载链接为:点击跳转

8、在命令行窗口输入 npm install appium --chromedriver_version="2.35" ,我的浏览器版本是 62.0.3202.84 对应匹配的 chromedriver为 2.35

9、待安装完成即可

 

posted @ 2018-09-30 10:12  iSZ  阅读(1777)  评论(0编辑  收藏  举报