1.基本操作元素方法 clear:清除 sendkeys:模拟键输入 click:单击 submit:提交表单 2.webelement接口常用方法 getsize():获取对象的大小 gettext():获取对象的文本 getAttribute():获取对象的属性值 getTagname():获取 ...
分类:
其他好文 时间:
2017-03-27 19:42:43
阅读次数:
191
@Testpublic void testHandleAlert(){ WebElement button =driver.findElement(By.xpath("input")); button.click(); try { //使用driver.switchTo().alert()方法获取A ...
分类:
编程语言 时间:
2017-03-01 12:23:13
阅读次数:
203
1、实例化一个浏览器WebDriver driver = new FirefoxDriver();2、driver.get() get传参数到浏览器中3、常用定位方法webelement XX=driver.findElement(by.XX)3.1 by.id("value");3.2 by.am ...
分类:
其他好文 时间:
2017-02-08 13:26:41
阅读次数:
127
packagemqTest;importjava.io.File;importorg.openqa.selenium.By;importorg.openqa.selenium.WebDriver;importorg.openqa.selenium.WebElement;importorg.openqa.selenium.firefox.FirefoxDriver;importorg.openqa.selenium.ie.InternetExplorerDriver;importorg.openqa.selen..
分类:
其他好文 时间:
2017-02-07 17:04:02
阅读次数:
142
1.findElements函数可用于多个元素定位 (1)使用ID定位:driver.findElement(By.id("ID值")); 例:HTML代码: 定位语句代码:WebElement username=driver.findElement(By.id("username")); WebE ...
分类:
其他好文 时间:
2017-01-12 08:19:12
阅读次数:
447
一、Appium_Python_Client介绍 Appium的实用方法都藏在Client的源码里,对于driver和webelement实例,均有对应的元素查找方法(webelement查找的是下面的子元素),有些儿专门针对手机的函数,则需要在这个Client安装后方可使用。 (以下内容转自:ht ...
分类:
移动开发 时间:
2016-12-28 20:49:29
阅读次数:
225
1.如果iframe有id或者name 2.如果iframe没有id或者name,可以用WebElement对象 3.切回主文档继续操作不在iframe中的元素,可以使用driver.switchTo().defaultContent() 4.如果存在嵌套的iframe,进入子iframe需要一层一 ...
分类:
其他好文 时间:
2016-12-26 16:17:01
阅读次数:
231
package com.allin.pc;import java.util.List;import org.openqa.selenium.WebElement;import org.openqa.selenium.By;import org.openqa.selenium.JavascriptEx ...
分类:
其他好文 时间:
2016-12-12 19:27:23
阅读次数:
216
package com.allin.pc;import java.util.List;import org.openqa.selenium.WebElement;import org.openqa.selenium.By;import org.openqa.selenium.JavascriptEx ...
分类:
Web程序 时间:
2016-12-12 19:13:59
阅读次数:
178
通过FindBy查找元素 @FindBy(id="notice01") private WebElement username; 相当于driver.findElement(By.id("notice01")); 示例: (1)测试类: (2)元素类: 执行后: ...
分类:
其他好文 时间:
2016-12-08 18:29:03
阅读次数:
199