Skip to content

Instantly share code, notes, and snippets.

public class NullWebElement implements WebElement {
private NullWebElement() {}
private static NullWebElement instance;
public static NullWebElement getNull() {
if (instance == null) {
instance = new NullWebElement();
}
public boolean isWebElementPresent() {
return driver.findElements(By.testLocator).size() > 0
}
@brobles82
brobles82 / relativeLocatorExample.java
Created January 28, 2020 23:08
basic relative locator
driver.findElement(withTagName("input")
.toRightOf(By.tagName("button")))
.sendKeys("hello");
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.6/ember.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
#content {
margin: 20px;
}
.block {
margin-top: 10px;
}
.block .btn {
cursor: pointer;
float: left;
margin: 0 10px 10px;