用户
 找回密码
 入住 CI 中国社区
搜索
分享 Selenium Driver 遍历select元素:
rosemarry 2015-9-14 13:46
WebDriver driver = new FirefoxDriver(); Navigation navigation = driver.navigate(); navigation.to( http://www.baidu.com ); navigation.to( http://tieba.baidu.com/f/search/adv ); WebElement select = driver.findElement(By.name("sm")); String targetText ="按相关性排序"; java.util.List WebElement ...
个人分类: Selenium|1278 次阅读|0 个评论
分享 Selenium+Driver+TestNg 依次运行多个测试类
rosemarry 2015-9-1 13:42
在实际的测试过程中肯定会存在一个流程的测试,但是流程会涉及到多个测试类,基于此肯定会要批量依次运行测试类, Selenium+Driver+TestNG框架,在运行测试用例后,会生成一个temp-testing-customsuite.xml的文件: !DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" suite thread-count="5" skipfaile ...
个人分类: Selenium|582 次阅读|0 个评论
分享 Selenium+Driver+TestNG的使用
rosemarry 2015-9-1 13:35
近来一直研究Selenium+Driver+Junit运行生成测试结果报告的事宜,虽说Junit稍后可以直接通过eclipse自身的Ant来生成报告,但是配置后运行总是出现无法正常运行的状态,随查资料说是版本的问题,后来找了很久也更换了版本终究还是无济于事。 然后看到论坛里有人提出可以使用TestNG生成报表,于是马不停蹄的配置,但是按照 ...
个人分类: Selenium|561 次阅读|0 个评论
分享 Selenium+Driver+Junit运行项目时出现:java.lang.UnsupportedClassVersionError: Bad ...
rosemarry 2015-9-1 13:22
使用MyEclipse 6.5时发现Java Compiler --- Compiler compliance level是5.0。之前一直在使用5.0的级别进行编译运行。当我切换Compiler compliance level到6.0以后,重新编译项目,运行,抛出异常: java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defi ...
个人分类: Selenium|575 次阅读|0 个评论
分享 Selenium+Driver+Junit 批量运行测试类
rosemarry 2015-8-31 16:17
Selenium+Driver+Junit 批量运行测试类
在使用Selenium+Driver+Junit框架进行自动化脚本开发过程中,有时候需要对将多个测试用例顺序运行:此前想过很多办法也查过很多资料均未实现,偶然的机会看到篇文章就是说的批量运行测试用例或者自定义运行测试用例。以下将自己的脚本附上: 其实Junit4自带了批量运行测试类的SuitCase测试套件: ...
个人分类: Selenium|621 次阅读|0 个评论
分享 Selenium启动各浏览器(firefox、Ie、Google)
rosemarry 2015-8-28 11:53
启动firfox: 只需要写: driver = new FirefoxDriver(); 启动IE浏览器: 需要下载与操作系统匹配的IEDriverServer.exe https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver 下载 启动IE,出现 Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException: Unexpect ...
个人分类: Selenium|1293 次阅读|0 个评论
分享 Selenium+Driver+Junit:将重复的代码写成接口直接调用
rosemarry 2015-8-27 17:49
Selenium+Driver+Junit:将重复的代码写成接口直接调用
在使用Selenium+Driver+Junit时,基本是每个功能写一份代码,其中有很多重复的代码。 为了脚本看起来简洁明了,虽将相同的代码整理出来放到一个公共的类中,其他类直接调用即成。 我有两个脚本,login.java 做界面登陆的。但是登陆之前需要打开浏览器,运行代码,关闭浏览器,基本每个测试类都要如此做,所以相同的不分 ...
个人分类: Selenium|1021 次阅读|0 个评论
分享 Selenium—junit——TestNG配置
rosemarry 2015-8-26 10:01
Selenium—junit——TestNG配置
在Eclipse中点击help——software Updates——Find And Install中输入TestNG 网址输入: http://beust.com/eclipse1 . 安装成功后重启Eclipse。然后点击Winow——show view——other
个人分类: Selenium|419 次阅读|0 个评论
分享 Selenium Junit————WebDriver 运行失败截图代码
rosemarry 2015-8-25 17:50
package Error_png; import org.junit.*; import org.openqa.selenium.*; import org.openqa.selenium.firefox.FirefoxDriver; import java.io.*; import org.apache.commons.io.FileUtils; import java.util.concurrent.*; import static org.junit.Assert.*; import static org.hamcrest.CoreMatchers.*; public class ...
个人分类: Selenium|642 次阅读|0 个评论
分享 Selenium——Webdriver
rosemarry 2015-8-25 14:52
WebDriver原理: 1、webdriver启动目标浏览器,并绑定到指定端口。该启动的浏览器实例,做为web driver的remote server 2、Client端通过CommandExcuter发送HTTPRequest给remote server的侦听端口(通信协议:the webdriver wire protocol) 3、Remote server需要依赖原生的浏览器组件(如:IEDriver.dll,c ...
个人分类: Selenium|531 次阅读|0 个评论