1. 作业解答 上节课给大家的作业是find element by.cssSelector. 我简单举一个例子 WebElement email = driver.findElement(By.cssSelector("#emailLink.ccNoUnderline"));email.click( ...
分类:
其他好文 时间:
2017-08-20 12:25:57
阅读次数:
159
方法一:WebElement element = driver.findElement(By.id("id_of_element")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", ...
分类:
其他好文 时间:
2017-08-17 00:44:44
阅读次数:
144
首先,我们使用如下方式初始化driver: 1.直接传入JavaScript代码 可以直接给jse传入javascript代码: 2.传入WebElement执行js: 又或者: 其中auguments[0]就代表element, 甚至我们可以传入更多的参数,比如 通过执行以上代码,我们指定的DIV ...
分类:
编程语言 时间:
2017-08-06 18:10:49
阅读次数:
207
自动化测试步骤 在自动化测试过程中, 测试程序通常的操作页面元素步骤 1. 找到Web的页面元素,并赋予到一个存储对象中 (WebElement) 2. 对存储页面元素的对象进行操作, 例如:点击链接,在输入框中输入字符等 3. 验证页面上的元素是否符合预期 通过这三个步骤, 我们可以完成一个页面元 ...
分类:
编程语言 时间:
2017-07-30 10:17:58
阅读次数:
164
爬虫任务里发现有部分图片没有加载完成就进行文件流上传,导致有一些图片是空白,需要判断一下: 首选获取image标签元素: WebElement image = driver.findElement(By.cssSelector("div#media_container > img")); boole ...
分类:
编程语言 时间:
2017-06-26 14:55:26
阅读次数:
234
Selenium 封装 Selenium 封装 WebDriver对页面的操作,需要找到一个WebElement,然后再对其进行操作,比较繁琐: [java] view plain copy WebElement element =driver.findElement(By.name("q")); ...
分类:
其他好文 时间:
2017-06-12 00:36:13
阅读次数:
280
火狐浏览器 package com.selenium.Glen;import org.openqa.selenium.By;import org.openqa.selenium.WebDriver;import org.openqa.selenium.WebElement;import org.op ...
分类:
其他好文 时间:
2017-06-02 14:50:04
阅读次数:
733
1.动态id定位不到元素for example: //WebElement xiexin_element = driver.findElement(By.id("_mail_component_82_82")); WebElement xiexin_element = driver.findElem ...
分类:
Web程序 时间:
2017-05-25 11:52:01
阅读次数:
269
packagetest;importorg.openqa.selenium.By;importorg.openqa.selenium.WebDriver;importorg.openqa.selenium.WebElement;importorg.openqa.selenium.chrome.ChromeDriver;importorg.testng.annotations.Test;publicclasslesson9{ @Test publicvoidtest()throwsInterruptedExce..
分类:
Web程序 时间:
2017-05-07 10:07:03
阅读次数:
155
a)clear——清除元素的内容 b)send_keys——在元素上模拟按键输入 c)click——单击元素 d)submit——提交表单 e)size——返回元素的尺寸 f)text——获取元素的文本 g)get_attribute(name)——获取元素的属性值 h)is_display()—— ...
分类:
Web程序 时间:
2017-04-09 00:32:05
阅读次数:
265