WebElement element = driver.findElements(By.id("block-id"));
assertNull(element);
this code snippet will get a NoSuchEleementException, use the following 2 implementations instead
1. make the test expect the very exception
@Test(expected = org.openqa.selenium.NoSuchElementException.class)
public void haveNoRecommendation() {
...
driver.findElement(By.id("block-id"));
}
2. use findElements
instead of findElement
public void elementNotExist(String id) {
List<WebElement> elements = driver.findElements(By.id(id));
assertTrue(elements.isEmpty());
}
分享到:
相关推荐
How To Verify the Word Size (32bit vs 64bit) of the Oracle Binary on MS Windows systems
本着方便大家,这是rabbitmq-server-3.8.3安装包,官网下载慢有需要的童鞋可以在这里下载
The book does not intends to give a deep insight into the finite element details, just the basic equations so that the user can modify the codes. The book was prepared for undergraduate science and ...
While PMI administers the process and establishes rules to promote fairness in the development of consensus, it does not write the document and it does not independently test, evaluate, or verify the...
How can we use a class Foo in a header file without access to its definition? We can declare data members of type Foo* or Foo&. We can declare (but not define) functions with arguments, and/or ...
模拟鼠标拖拽,网页拖拽验证
使用VMM RAL进行Register 、memory、验证
The purpose of this article is to provide a step-by-step instruction on how to install the DBWS Callout Utilities on Oracle Database Server 10g and how to verify that it works properly. After ...
We will also learn how to access files stored in IPFS, use the strings library to work with strings, and more. Chapter 8, Building Enterprise Level Smart Contracts, explains how to use Truffle, which...
Preconditions: Verify that the specified assembly and part exist. Postconditions: 1. Opens the specified assembly document. 2. Examine the graphics area, then press F5. 3. Changes the selected ...
验证Selenium 扩展“以允许使用验证Web UI。 可通过获得支持。 内容 NuGet包 用法 启用 在程序集加载时一次启用VerifySelenium: VerifySelenium . Enable (); | 构建WebDriver ChromeOptions options = new ()...
To provide an outline for those common technologies, I used the objectives in place as of January 2009 for the Cisco Certified Network Professional (CCNP) certification. It would be difficult to ...
* "git bundle verify" needs to see if prerequisite objects exist in the receiving repository, but the command did not check if we are in a repository upfront, which has been corrected. * "git ...
It helps engineers measure their system, showing how to verify if a prototype is stable and features enough design margin. Moreover, professionals learn how to secure high-volume production by bench-...
port interfaces and provides details on the specifications and the latest standards, enabling you to select an interface for a new design or verify that an interface is working correctly. Each chapter...
Any reference to an IBM product, program, or service is not intended to state or imply that only that IBM product, program, or service may be used. Any functionally equivalent product, program, or ...
The Development Guide shows your project how to architect and build a secure application, this Code Review Guide tells you how to verify the security of your application's source code, and the ...
While PMI administers the process and establishes rules to promote fairness in the development of consensus, it does not write the document and it does not independently test, evaluate, or verify the...
You’ll learn when to create indexes, how to verify that they make a difference, how to use SQL Profiles to optimize SQL in packaged applications, and much more. You’ll also understand how SQL is ...
We will also learn how to access files stored in IPFS, use the strings library to work with strings, and more. Chapter 8, Building Enterprise Level Smart Contracts, explains how to use Truffle, which...