- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
以下 MWE(由 Packt 出版商出版的 Unmesh Gundecha 出版的《Selenium 测试工具手册,第 2 版》中描述)是使用 Selenium 测试框架进行的网站测试。
package locators;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.WebElement;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class TableExample {
protected WebDriver driver;
@Before
public void setUp() {
driver = new ChromeDriver();
driver.get("http://dl.dropbox.com/u/55228056/Locators.html");
}
@Test
public void testWebTable() {
WebElement simpleTable = driver.findElement(By.id("items"));
//Get all rows
List<WebElement> rows = simpleTable.findElements(By.tagName("tr"));
assertEquals(3, rows.size());
//Print data from each row
for (WebElement row : rows) {
List<WebElement> cols = row.findElements(By.tagName("td"));
for (WebElement col : cols) {
System.out.print(col.getText() + "\t");
}
System.out.println();
}
}
@After
public void tearDown() {
driver.close();
}
}
使用以下 Maven pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>getting-started-with-selenium</groupId>
<artifactId>getting-started-with-selenium</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>getting-started-with-selenium</name>
<description>A quick and easy start-up browser automation framework using Selenium</description>
<properties>
<selenium_version>2.43.1</selenium_version>
</properties>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/main/java</testSourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>io.ddavison</groupId>
<artifactId>conductor</artifactId>
<version>[1,)</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
</project>
Conductor Framework 是一个基于 Selenium 构建的框架,它 promise 最大限度地减少 Java 中的 Selenium 编码。
据我所知,除了 https://github.com/conductor-framework/conductor 页面之外,没有关于 Conductor 的任何文档。 。
如果使用 Conductor 框架,TableExample 类中的 testWebTable(请参阅上面的测试)会是什么样子? - 是否有更多有关 Conductor 的文档(无论何种形式)?
最佳答案
通过反复试验,我发现使用 Conductor 框架,以下类可以按预期工作。
import io.ddavison.conductor.Browser;
import io.ddavison.conductor.Config;
import io.ddavison.conductor.Locomotive;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import java.util.List;
import static org.junit.Assert.assertEquals;
// nilostep
@Config(
url = "http://dl.dropbox.com/u/55228056/Locators.html", // base url that the test launches against
browser = Browser.CHROME, // the browser to use.
hub = "" // you can specify a hub hostname / ip here.
)
public class TableExample2 extends Locomotive {
@Test
public void testWebTable2() {
WebElement simpleTable = waitForElement(By.id("items"));
//Get all rows
List<WebElement> rows = simpleTable.findElements(By.tagName("tr"));
assertEquals(3, rows.size());
//Print data from each row
for (WebElement row : rows) {
List<WebElement> cols = row.findElements(By.tagName("td"));
for (WebElement col : cols) {
System.out.print(col.getText() + "\t");
}
System.out.println();
}
}
}
关于java - 如果使用 Conductor 框架,这个测试用例(使用 Selenium WebDriver 用 Java 编写)会是什么样子?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39425900/
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 3 年前。 Improve th
根据我的理解,jmp 执行无条件跳转,而 ja 如果值无符号则跳转。我的理解对吗? 如果有一个例子,我们将不胜感激。 最佳答案 您说得对,jmp 执行的是无条件跳转。 不过,您对 ja 的描述不正确。
我无法理解这一点。它是 intel 语法 cmp eax, 0x19 ja greater eax 包含值 -40。 http://en.wikibooks.org/wiki/X86_Assembly
我无法理解汇编语言的 ja 和 jg 之间的区别。我有一段代码: cmp dh, dl j-- hit 我询问哪个条件跳转命中(替换 j-- 命中)将采用 DX = 0680 的十六进制值。 这会
我尝试使用 MATLAB Builder JA 在 Java 中运行 MATLAB 代码获取 JAR 文件。 test.m 工作正常,但不是依赖于 test.m 的 test2.m。 我的项目需要依赖
这个问题在这里已经有了答案: Java : recursive constructor call and stackoverflow error (5 个答案) 关闭 4 年前。 为什么在下面的程序
在我的 sitecore 网站中,客户要求进行一些改进。他们要我将/ja-jp/网站的标准字体样式更新为 Microsoft 的 Meiryo 字体。这包括更新与所有模板和子布局相关的所有基于 HTM
对于斯堪的纳维亚字母以及对其进行编码时,我遇到了问题。使用下面的代码,javascript向变量添加一些额外的编码 function doit(params) { var ur
本文整理了Java中com.ja.yuml.render.remote.YumlRemoteRenderer类的一些代码示例,展示了YumlRemoteRenderer类的具体用法。这些代码示例主要来
如 here 所述,Mozilla 在 Firefox/Thunderbird 中使用类似 zip 的方法来处理他们的 omni.ja。 .在同一篇文章中,他们只列出了用于解压缩的 Windows 工
我是 R 和协整的新手,所以在我尝试解释我正在尝试做的事情时请耐心等待。我试图在加拿大/美国西部电力系统的 1500-2000 个电压变量中找到协整变量。频率是每小时一次(在幂中很常见),协整组合可以
我尝试使用 JDK 9 和 gradle 构建一个已经存在的项目。 我想我的模块加载有问题。 这是我的 gradle 依赖项的示例: compile("org.springframework:spri
首先我要提前感谢大家阅读这么长的帖子。我真的很感谢你的帮助。 问题是我一直在研究如何为我正在为大学工作的项目“连接”Matlab 和 Java。我认为最合适的选择是使用 Matlab Builder
我在使用 Java 调用 MATLAB JA Builder 编译代码时遇到了一个奇怪的问题。详情如下: 代码对大型 .mat 文件执行 load() 如果在 MATLAB 中打开 mat 文件(通过
我的网站使用 JA Merro joomla 模板。但是当我当时从用户站点查看添加的文章时,某些类型的操作系统垃圾值会显示在文章的开头和结尾处。 “горящие туры в Индонезию”故
我在运行 testcafe 时有时会遇到错误 /opt/testcafe/node_modules/testcafe-hammerhead/lib/request-pipeline/connectio
所以我的目标是写出对应于这个程序集的 C 代码: 0: 85 f6 test %esi,%esi 2: 78 13 js
由于我的主要操作系统是linux并且在visual studio上有项目,所以我决定使用在线编译器来实现它。我找到了 this这是许多人建议的。所以这是我的代码: #include using na
目前,我正在使用 PhotoEditor 开发一个 Android 应用程序图书馆。我已按照页面上的说明进行了入门和设置 View 部分的操作。但是,不知何故,我无法膨胀包含 PhotoEditorV
我一直在尝试用 Java 运行 hello world 示例,使用 Matlab Builder JA 编译在装有 Snow Leopard 的 Intel Mac 上。当我在终端上运行 .jar 时
我是一名优秀的程序员,十分优秀!