Skip to content

Instantly share code, notes, and snippets.

@hackertron
Created September 2, 2018 21:39
Show Gist options
  • Save hackertron/cadaf4b95ee0193625199316cdd5f100 to your computer and use it in GitHub Desktop.
Save hackertron/cadaf4b95ee0193625199316cdd5f100 to your computer and use it in GitHub Desktop.
package javadriverexample;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedCondition;
import java.util.concurrent.TimeUnit;
public class javadrive {
public static void main(String[] args)
{
// declare and instantiate of objects/varibales
WebDriver driver = new FirefoxDriver();
String baseurl = "http://www.google.com";
// launch firefox and direct it to baseurl
driver.get(baseurl);
driver.get("http://www.google.com");
driver.findElement(By.xpath("//input[@type='text']")).sendKeys("Cheese");
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
driver.findElement(By.name("btnK")).click();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment