This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void mouseClickByLocator( String cssLocator ) { | |
String locator = cssLocator; | |
WebElement el = driver.findElement( By.cssSelector( locator ) ); | |
Actions builder = new Actions(driver); | |
builder.moveToElement( el ).click( el ); | |
builder.perform(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private ExpectedCondition<Boolean> element(final By findCondition) { | |
return new ExpectedCondition<Boolean>() { | |
@Override | |
public Boolean apply(WebDriver from) { | |
RenderedWebElement element = (RenderedWebElement) | |
driver.findElement(findCondition); | |
return element.isDisplayed(); | |
} | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//use testingbot.com or saucelabs or roll your own remote webdriver server | |
import junit.framework.TestCase; //removes need for annotations by extending | |
import org.openqa.selenium.*; | |
import org.openqa.selenium.remote.*; | |
import java.net.URL; | |
import java.util.concurrent.TimeUnit; | |
public class RWDTest extends TestCase { | |
private WebDriver driver; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List | |
import static extension java.util.Collections.* | |
class CollectionFilter { | |
def static void main(String[] _) { | |
val values = new ArrayList( 1, 5, 33, 0, -2, -10, 4, 36, -82 ) | |
positiveOnly( values ) | |
negativeOnly( values ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public WebElement waitFindElement(WebDriver drv, By by, long timeout, long interval) | |
{ | |
long start = System.currentTimeMillis(); | |
while(true){ | |
try{ | |
return drv.findElement(by); | |
} catch(NoSuchElementException nse) { | |
if(System.currentTimeMillis()-start>=timeout) | |
{ | |
throw new Error("Timeout reached and element["+by+"]not found"); |
NewerOlder