5--Selenium环境准备--firefox与geckodriver
selenium2时打开firefox浏览器是不需要安装firefoxdriver的,但是selenium3不支持向前支持火狐浏览器了,40以后版本的火狐,运行会出现问题。
1、下载geckodriver
https://github.com/mozilla/geckodriver/releases
chrome浏览器需要下载chromedriver
然后在代码中添加即可
public class lesson4 {
@Test
public void BrowserTest() throws InterruptedException{
/*----------------------------lesson1--------------------打开浏览器*/
//chrome浏览器需要添加chromedriver,ie需要增加internateExplorerdriver
//而selenium2中firefox无需,selenium3中需要添加geckodriver
System.setProperty("webdriver.gecko.driver", "G:/Testing/selenium/geckodriver.exe");
//打开浏览器
WebDriver dr=new FirefoxDriver();
Thread.sleep(2000);
/*----------------------------lesson2--------------------------*/
//浏览器最大化
dr.manage().window().maximize();
//打开百度
dr.get("https://www.baidu.com/");
//获取打开页面的title,并判断title是否正确
System.out.println("the title is:"+dr.getTitle());
System.out.println("Current url is:"+dr.getCurrentUrl());
//判断页面跳转的方式:打开一个url,等待3s,在获取currenturl,判断,不相等则发生跳转成功
//判断页面跳转的方式:通过页面的title判断
/*----------------------------lesson3--------------------------*/
//自定义profile
//关闭浏览器:close--只是关闭浏览器,但是服务不停,quit服务也会停掉,推荐quit
dr.quit();
}
参考资料:https://blog.csdn.net/jinhe123/article/details/69946234
5--Selenium环境准备--firefox与geckodriver的更多相关文章
- 在Centos7下docker配置自动化环境镜像(python3.7+selenium 3.11+firefox 62+geckodriver 0.21)
最近在学习Docker,准备做自动化测试代码集成的功能.如下文章的前提是已经安装好linux系统,且成功安装好Docker. 接下来我会按步骤一步一步的对自动化需要的一些环境进行安装,如果没有特别说明 ...
- python selenium环境配置Firefox和Chrome
1.下载Selenium库,可以使用pip install selenium https://pypi.python.org/pypi/selenium/ 2.下载驱动 Chrome: https:/ ...
- 【selenium 3】 Mac 下测试环境搭建 Firefox 47+ gecko driver Mac
错误代码如下:File "/usr/local/lib/python2.7/dist-packages/selenium-3.0.0b2-py2.7.egg/selenium/webdriv ...
- 篇5 python自动化测试应用-Selenium环境篇
篇5 python自动化测试应用-Selenium环境篇 --lamecho 1.1概要 大家好!我是lamecho(辣么丑),从本篇开始我将开始 ...
- Python3+Selenium环境配置
一.所需工具 1.Python3.6安装包 2.Selenium安装包(selenium-server-standalone-3.8),如果是Python3的话可以不用下载selenium压缩包,Py ...
- windows下使用selenium报错selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH
问题 :执行程序代码报错: WebDriverException:Message:'geckodriver'executable needs to be in Path 或者 selenium.com ...
- python+selenium 环境配置
配置环境: python:3.5 selenium:3.3.0 安装方式:python pip install -u selenium windows: 10 firefox:52 因为firefox ...
- 搭建Selenium环境
1.下载并安装Python 此学习笔记使用Python语言进行开发,所以我已经安装了Python环境,我的Python版本为3.5.2: 2.安装selenium 因为我使用的Python3版本,在该 ...
- selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH. 错误处理方法
首次使用selenium webdriver,webdriver.Firefox() 报错selenium.common.exceptions.WebDriverException: Message: ...
随机推荐
- HTML标签(二)
一.字体标签 字体标签包含:h1~h6.<font>.<u>.<b>.<strong><em>.<sup>.<sub> ...
- [CodeForces - 614E] E - Necklace
E - Necklace Ivan wants to make a necklace as a present to his beloved girl. A necklace is a cyclic ...
- 五、持久层框架(Hibernate)
一.分页查询 使用Criteria进行分页查询,无论是使用Oracle,MySQL,NoSQL,DB2,分页查询的代码写法都相同. 分页查询代码示例: package com.demo.test; i ...
- Ubuntu中的在文件中查找和替换命令
分类: 9.Linux技巧2009-09-29 13:40 1429人阅读 评论(0) 收藏 举报 ubuntujdbc 1.查找 find /home/guo/bin -name /*.txt | ...
- 用WebStorm进行Angularjs 2的开发
环境准备: WebStorm开发工具 https://pan.baidu.com/s/1o8maQLG 提取密码(加群获取599606903) nodejs https://nodejs.org ...
- learning ddr tRP and tRP tRTP CL tRAS
referce :https://blog.csdn.net/ghostyu/article/details/7728106 tRP(RAS Precharge Time): “内存行地址控制器预充电 ...
- 【资料收集】QT 环境安装配置
(很详细,极力推荐) [OpenCV] -- win7下配置OpenCV的Qt开发环境 - 代码人生 - 博客频道 - CSDN.NET http://blog.csdn.net/qiurisuix ...
- oracle sqlserver mysql 通过sql查看表及字段注释
oracle: SELECT A.TABLE_NAME,A.COMMENTS,B.COLUMN_NAME,B.COMMENTS FROM USER_TAB_COMMENTS A,USER_COL_CO ...
- vue-1-模板语法
文本 <span>Message: {{ msg }}</span><span v-once>这个将不会改变: {{ msg }}</span> 原始 ...
- 类型重命名 typedef
所谓数据重命名就是给数据类型起一个新的名字,比如int 这个数据类型,可以给他起一个新的名字叫 my int.他俩的用法.特点.属性等是一模一样,仅仅名字不同而已. 作用:1,增加代码的可读性.2,让 ...