文章分类 -  selenium

摘要:需要的jar包:selenium-java-xx.jar,selenium-serven-standalone-xx.jar,testng-xx.jar velocity-dep-xx.jar,reportng-xx.jar,guice-xx.jar 上面xx都代表版本。 ant的build.xml 阅读全文
posted @ 2016-04-25 17:13 Free-program 阅读(171) 评论(0) 推荐(0)
摘要:1.下载安装jenkins。并且安装下载seleniumhq plugin,ant plugin,testng插件。2.下载安装svn3.下载安装ant并设置环境变量。cmd 命令中输入ant,如果提示:Buildfile: build.xml does not exist! 则说明成功。4.编写代... 阅读全文
posted @ 2015-05-21 11:16 Free-program 阅读(560) 评论(0) 推荐(0)
摘要:1.下载testng-xslt.zip文件。解压。得到testng-xslt-1.1文件。2.在eclipse工程主目录中新建一个lib文件,然后将testng-xslt-1.1\lib文件夹下的saon-8.7.jar文件复制到项目的lib文件夹中,并且Add Build Path。3.再将tes... 阅读全文
posted @ 2015-04-15 15:00 Free-program 阅读(124) 评论(0) 推荐(0)
摘要:有时候需要对滚动条进行操作。用js实现。代码如下:$('元素id或者其它属性').scrollTop(); ----如果scrolltop里面参数为空,则获取当前滚动条位置的值。$('元素id或者其它属性').scrollTop(n); ----如果scrolltop里面有参数,则跳到滚动条为该值的... 阅读全文
posted @ 2015-02-09 11:02 Free-program 阅读(1347) 评论(0) 推荐(0)
摘要:突然忘记Jenkins服务怎么重启了。刚重启了下。记下来:找到jenkins目录中jenkins.war文件。然后进入cmd 定位到该文件。执行:java -jar jenkins.war 阅读全文
posted @ 2014-12-29 11:41 Free-program 阅读(132) 评论(0) 推荐(0)
摘要:TestNG annotation:@BeforeSuite:被注释的方法将在所有测试运行前运行@AfterSuite:被注释的方法将在所有测试运行后运行@BeforeTest:被注释的方法将在测试运行前运行@AfterTest:被注释的方法将在测试运行后运行@BeforeGroups:被配置的方法... 阅读全文
posted @ 2014-12-18 15:01 Free-program 阅读(401) 评论(0) 推荐(0)
摘要:加个方法:比如标签ul下有一个class。class=test下又有多个li标签。如果用css需要定位到第5个li标签。那么可以用ul.test>li:nth-child(5)ps:转载的。 阅读全文
posted @ 2014-09-03 14:53 Free-program 阅读(117) 评论(0) 推荐(0)
摘要:因为项目需要用到上传文件,就会弹出windows窗口。selenium又没法处理那些窗口。所以只能借助第三方工具对windows窗口操作。工具:aotuit 首先编辑脚本,然后用其中一个工具将脚本转换成exe文件。脚本代码如下:1.Dim $path = "C:\Users\Administrato... 阅读全文
posted @ 2014-09-02 11:42 Free-program 阅读(1474) 评论(0) 推荐(0)
摘要:代码:List check = driver.findElements(By .name("bindBatchRegion_check")); for (int i = 0; i < check.size(); i++) { check.get(i).click(); }说明:该页面所有控件... 阅读全文
posted @ 2014-08-29 15:56 Free-program 阅读(594) 评论(0) 推荐(0)
摘要:首先,下载jexcelapi。然后导入到excel。例1:代码:import java.io.File; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; public class Test { public static... 阅读全文
posted @ 2014-08-28 13:24 Free-program 阅读(375) 评论(0) 推荐(0)
摘要:代码如下: //调用js修改对象ID的value ((JavascriptExecutor)driver).executeScript("document.getElementById('eventSearchStartTime').value ='2014-08-28 00:00:00'");说... 阅读全文
posted @ 2014-08-26 15:55 Free-program 阅读(105) 评论(0) 推荐(0)
摘要:代码如下:for (String winHand : driver.getWindowHandles()) { driver.switchTo().window(winHand); }说明:遍历当前浏览器所有窗口,并获取窗口句柄。 阅读全文
posted @ 2014-08-26 15:49 Free-program 阅读(105) 评论(0) 推荐(0)
摘要:说明:获取当前剪贴板中的值,然后输出。代码如下:package xiaobao;//获取当前剪贴板中的值import java.awt.Toolkit;import java.awt.datatransfer.Clipboard;import java.awt.datatransfer.DataFl... 阅读全文
posted @ 2014-08-21 16:31 Free-program 阅读(329) 评论(0) 推荐(0)
摘要:由于一点小需求,需要用到截屏。个人记录,代码如下:public class screen { public void screenFun() { //获取当前时间时间戳 long timestamp = new Date().getTime(); String title = driver... 阅读全文
posted @ 2014-08-21 16:28 Free-program 阅读(142) 评论(0) 推荐(0)
摘要:如图:我需要找到“个人资料”这个对象,但是上方的代码中写的display状态为none,所以导致无法找到该对象 ---》By.id(profile_userProfile)。所以需要更改display的状态,代码如下:JavascriptExecutor j= (JavascriptExecuto... 阅读全文
posted @ 2014-07-15 16:38 Free-program 阅读(208) 评论(0) 推荐(0)