java+selenium3配置

由于Firefox的必要升级,导致之前的selenium2无法使用,只能对selenium进行升级

目前我的Firefox版本为v54.0,下载selenium3.4.0,下载selenium3必须要有的Firefox驱动geckodriver.exe,下载jdk8

Firefox:http://ftp.mozilla.org/pub/firefox/releases/

selenium:http://selenium-release.storage.googleapis.com/index.html

geckodriver:https://github.com/mozilla/geckodriver/releases

将selenium-server-standalone-3.4.0.jar及geckodriver.exe放到lib目录下,同时将selenium进行替换

原先我使用的是2.53.1,在右键项目-> Build Path -> Configure Build Path中进行删除,在右键selenium -> Build Path -> Add To Build Path中进行添加

selenium3.X目前需要jdk8的支持,所以还需要对编译环境进行配置

原先的java代码也需要进行修改

build.xml文件(如果是使用Junit的话):

<path id="RegressionTest.classpath">
		<pathelement location="bin" />
		<pathelement location="lib/selenium-server-standalone-3.4.0.jar" />
		<pathelement location="lib/junit.jar" />
		<pathelement location="lib/org.hamcrest.core_1.3.0.v201303031735.jar" />
		<pathelement location="lib/common-lang3.jar" />
	</path>

在driver启动代码中进行修改:

@Test
	public void initFirefox() throws Exception {
		System.setProperty("webdriver.firefox.marionette", "lib//geckodriver.exe");
		driver = new FirefoxDriver();
		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
	}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值