selenium之使用chrome浏览器测试(chromedriver与chrome版本对应表)

前端之家收集整理的这篇文章主要介绍了selenium之使用chrome浏览器测试(chromedriver与chrome版本对应表)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

《selenium之使用chrome浏览器测试(chromedriver与chrome版本对应表)》要点:
本文介绍了selenium之使用chrome浏览器测试(chromedriver与chrome版本对应表),希望对您有用。如果有疑问,可以联系我们。

chromedriver与chrome的的对应版本的好麻烦,如今整理下:

chromedriver版本支持的Chrome版本
v2.37v64-66
v2.36v63-65
v2.35v62-64
v2.34v61-63
v2.33v60-62
v2.32v59-61
v2.31v58-60
v2.30v58-60
v2.29v56-58
v2.28v55-57
v2.27v54-56
v2.26v53-55
v2.25v53-55
v2.24v52-54
v2.23v51-53
v2.22v49-52
v2.21v46-50
v2.20v43-48
v2.19v43-47
v2.18v43-46
v2.17v42-43
v2.13v42-45
v2.15v40-43
v2.14v39-42
v2.13v38-41
v2.12v36-40
v2.11v36-40
v2.10v33-36
v2.9v31-34
v2.8v30-33
v2.7v30-33
v2.6v29-32
v2.5v29-32
v2.4v29-32

 
chromedriver驱动的下载地址如下: 
http://chromedriver.storage.googleapis.com/index.html


chromedriver的版本需要和本机的chrome浏览器对应,才能正常使用;

第一步:下载对应版本的chromedriver驱动文件,具体版本请对照文章底部的对应关系表:

如本机的chrome浏览器版本为:版本 61.0.3163.100(正式版本) (64 位),对应的chromedriver版本为2.33.

selenium之使用chrome浏览器测试(chromedriver与chrome版本对应表)

 第二步:下载后把文件解压,然后放到本机chrome浏览器文件路径里,如:

C:\Program Files (x86)\Google\Chrome\Application

selenium之使用chrome浏览器测试(chromedriver与chrome版本对应表)


第三步:操作完后,就可以使用以下代码直接调起浏览器了:

driver = new ChromeDriver();

selenium之使用chrome浏览器测试(chromedriver与chrome版本对应表)


对于node.js,则是(以下两种一样,上一种是监听端口,下一种可以配合Http组件使用,同样达到监听端口的作用):

//var driver = new webdriver.Builder().usingServer('http://192.168.6.20:9515/').withCapabilities(webdriver.Capabilities.chrome()).build();
var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).build();

又如示例:

var webdriver = require('selenium-webdriver');

var driver = new webdriver.Builder().
withCapabilities(webdriver.Capabilities.chrome()).
build();

driver.get('http://www.google.com');
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
driver.findElement(webdriver.By.name('btnK')).click();
driver.wait(function() {
       return driver.getTitle().then(function(title) {
              return title === 'webdriver - Google Search';
       });
}, 1000);

driver.quit();

猜你在找的Node.js相关文章