Selenium WebDriver java 简单实例】的更多相关文章

开发环境 JDK 下载地址: http://www.oracle.com/technetwork/java/javase/downloads/index.html Eclipse: 下载地址:http://www.eclipse.org/downloads/ Selenium jar包 (这里用的是:selenium-java-2.45.0.zip ,selenium-server-standalone-2.45.0.jar) 下载地址:http://code.google.com/p/sele…
Selenium Webdriver 学习: http://jarvi.iteye.com/category/203994 https://github.com/easonhan007/webdriver_guide Selenium WebDriver经验杂记:http://blog.csdn.net/ant_yan/article/details/8185899http://blog.csdn.net/aerchi/article/category/936247 1. Selenium We…
1. 获取元素文本 WebElement类的getText()方法返回元素的innerText属性.所以元素里如果有子节点一样也会被返回出来.如下所示 public class GetText { @Test public void testGetText(){ //启动driver,打开被测页面 System.setProperty("webdriver.chrome.driver", "chromedriver.exe"); WebDriver driver =…
环境准备 前提条件Eclipse 已经安装过 TestNg ,Maven 插件 新建一个普通的java项目 点击右键 configure->convert to Maven Project 之后点击finish,项目转换后会多出来几个文件夹,和pom.xml 然后使用Pom.xml 替我们管理jar包,修改pom.xml文件,添加jar包的依赖, <dependencies> <dependency> <groupId>org.seleniumhq.seleniu…
转载自:http://blog.csdn.net/xiao190128/article/details/49784121 1.打开一个测试浏览器 对浏览器进行操作首先需要打开一个浏览器,接下来才能对浏览器进行操作. Java代码 import java.io.File; import org.openqa.selenium.WebDriver; importorg.openqa.selenium.firefox.FirefoxBinary; importorg.openqa.selenium.f…
[From] http://blog.csdn.net/xiao190128/article/details/49784121 1.打开一个测试浏览器 对浏览器进行操作首先需要打开一个浏览器,接下来才能对浏览器进行操作. Java代码 import java.io.File; import org.openqa.selenium.WebDriver; importorg.openqa.selenium.firefox.FirefoxBinary; importorg.openqa.seleniu…
Selenium WebDriver提供了隐式等待来同步测试.当使用了隐式等待执行测试的时候,如果WebDriver没有在DOM中找到元素,将继续等待,超出设定时间后,抛出找不到元素异常 即,当元素没有立即出现的时候,隐式等待将等待一段时间后,再查找DOM.默认时间是0. 一旦设置了隐式等待,它将存在在整个webdriver对象实例的生命周期中,隐式等待会让一个正常响应的应用的测试变慢,会在寻找每个元素时进行等待,这样增加了整个测试执行的时间. 应该避免或减少使用隐式等待 //等待60s dri…
下面这段实例实现了以下功能: 1. profile使用用户本地电脑上的 (selenium 3有问题.因为selenium 3把profile复制到一个temp文件夹里,但并不复制回去.所以每次打开仍是一个空的浏览器.问题待解决) 2. 取出多个跳出框的title和内容 3. 验证打开页面的title是否正确 4. 获取页面弹出框中的验证码 package com.qiujy.testweb_mvn; import java.io.File; import java.io.IOException…
最早接触的selenium是 selenium IDE,当时是为了准备论文.为了用IDE还下载了Firefox浏览器.后来接触过两个项目都需要selenium,一个采用selenium webdirver+junit4 +java,另外一个是采用 robot+selenium2library .总体感觉就是开源.简单.使用范围广.是网页测试必备单品. 关于selenium的好的学习资料: 官方User Guide:  http://seleniumhq.org/docs/ 官方API:  htt…
策略 语法 语法 描述 By id driver.findElement(By.id()) driver.findElements(By.id()) 通过id属性定位元素 By name driver.findElement(By.name()) driver.findElements(By.name()) 通过name属性定位元素 By class name driver.findElement(By.className()) driver.findElements(By.className(…