Created
September 2, 2018 21:39
-
-
Save hackertron/cadaf4b95ee0193625199316cdd5f100 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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