Skip to content

Instantly share code, notes, and snippets.

@miketoth
Last active April 4, 2017 18:48
Show Gist options
  • Save miketoth/cc66e545ddbc322f863ba6669aaebbfa to your computer and use it in GitHub Desktop.
Save miketoth/cc66e545ddbc322f863ba6669aaebbfa to your computer and use it in GitHub Desktop.
Selenium Test Java
package com.way2b1.examples;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.Wait;
import org.openqa.selenium.support.ui.WebDriverWait;
public class GoogleSearch {
static WebDriver driver;
static Wait<WebDriver> wait;
public static void main(String[] args) {
driver = new FirefoxDriver();
wait = new WebDriverWait(driver, 30);
driver.get("http://www.google.com/");
boolean result;
try {
result = firstPageContainsWay2b1();
} catch(Exception e) {
e.printStackTrace();
result = false;
} finally {
driver.close();
}
System.out.println("Test " + (result? "passed." : "failed."));
if (!result) {
System.exit(1);
}
}
private static boolean firstPageContainsWay2b1() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment