随笔分类 -  测试工具-selenium

selenium2-java 浏览器下进行登录
摘要:完整代码实现如下: package linear;import org.openqa.selenium.By;import org.openqa.selenium.WebDriver;import org.openqa.selenium.chrome.ChromeDriver;/* * 李盈辉 *2 阅读全文
posted @ 2016-12-02 17:36 漫步馥路道 阅读(553) 评论(0) 推荐(0)
selenium2-java 浏览器cookie的获取
摘要://成功登陆后增加如下代码 File cookieFile = new File("C:\\tmp\\tangdai.cookie.txt"); cookieFile.delete(); cookieFile.createNewFile(); FileWriter fileWriter = new 阅读全文
posted @ 2016-12-02 17:19 漫步馥路道 阅读(512) 评论(0) 推荐(0)
selenium2-java 浏览器不同窗口切换
摘要:1,获取浏览器的单个窗口: String parentWindowid = driver.getWindowHandle(); System.out.println(parentWindowid); 2,多个窗口切换: 1,获取浏览器的单个窗口: 1,获取浏览器的单个窗口: String paren 阅读全文
posted @ 2016-12-01 18:38 漫步馥路道 阅读(605) 评论(0) 推荐(0)
selenium2-java 浏览器的三种弹窗处理
摘要:alert弹窗 confirm弹窗 prompt弹窗 点击确定 点击确定 // 选取警告弹窗 Alert alert=driver.switchTo().alert(); // 点击取消按钮 alert.accept(); 点击取消 点击取消 // 选取警告弹窗 Alert alert=driver 阅读全文
posted @ 2016-11-29 16:05 漫步馥路道 阅读(1802) 评论(0) 推荐(0)
selenium2-java 浏览器操作常用命令语法
摘要:WebDriver driver = new ChromeDriver(); WebDriver driver = new ChromeDriver(); xpath定位:driver.findElement(By.xpath("//div[@id='register518']/span[2]")) 阅读全文
posted @ 2016-11-28 13:59 漫步馥路道 阅读(827) 评论(0) 推荐(0)
如果遇到找不到元素如何处理? Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"id","selector":"investmentframe"}
摘要:常见几种原因与应对,详细参见http://www.blogjava.net/qileilove/archive/2014/12/11/421309.html 1,动态ID无法找到,用xpath路径解决; 2,iframe导致,用先定位frame方式解决; 3,不在一个frame里,用切换到默认的co 阅读全文
posted @ 2016-11-07 10:52 漫步馥路道 阅读(1252) 评论(0) 推荐(0)
selenium2-java环境搭建 示例为chrome浏览器
摘要:首先,安装并配置JDK,安装eclipse,安装firefox和chrome。下载selenium语言的JAVA库文件,下载地址为,如果打不开,则需要FQ;http://www.seleniumhq.org/download/; 其次, 在eclipse中新建项目,在新建项目中将下载的seleniu 阅读全文
posted @ 2016-10-25 17:28 漫步馥路道 阅读(3971) 评论(0) 推荐(0)
selenium报错汇总
摘要:报错:[error] Could not connect to Selenium Server. Have you started the Selenium Server yet? 解决:selenium两种驱动方式,一是use selenium IDE,一种是use selenium webdri 阅读全文
posted @ 2016-10-19 18:43 漫步馥路道 阅读(1042) 评论(0) 推荐(0)
seleniumIDE command命令
摘要:语法组成要素:command、target、value。 command命令 三大类型:(action、Accessor、assertion) 操作 存储 断言 操作类型——Action selectPopUp("windowID") 无参数,表示选择弹出窗口;参数可以是新窗口的名字、标题。。 存储 阅读全文
posted @ 2016-10-10 17:12 漫步馥路道 阅读(3201) 评论(0) 推荐(1)
seleniumIDE回放找不到页面元素
摘要:如下所示,自动回放就报错,手动执行就不报错。 产生这种情况的原因有多种情况 或许还有其他原因,遇到了再补充。 阅读全文
posted @ 2016-09-29 17:36 漫步馥路道 阅读(625) 评论(0) 推荐(0)