Search in sources :

Example 51 with WebDriver

use of org.openqa.selenium.WebDriver in project java.webdriver by sayems.

the class isDisplayed method main.

public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    WebElement searchButton = driver.findElement(By.name("btnK"));
    System.out.println(searchButton.isDisplayed());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) WebElement(org.openqa.selenium.WebElement)

Example 52 with WebDriver

use of org.openqa.selenium.WebDriver in project java.webdriver by sayems.

the class isEnabled method main.

public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    WebElement searchButton = driver.findElement(By.name("btnK"));
    System.out.println(searchButton.isEnabled());
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) WebElement(org.openqa.selenium.WebElement)

Example 53 with WebDriver

use of org.openqa.selenium.WebDriver in project java.webdriver by sayems.

the class GetWindowName method main.

public static void main(String[] args) {
    WebDriver driver = new ChromeDriver();
    driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
    driver.navigate().to("http://www.google.com");
    JavascriptExecutor js = (JavascriptExecutor) driver;
    System.out.println(js.executeScript("return window.name"));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) JavascriptExecutor(org.openqa.selenium.JavascriptExecutor) ChromeDriver(org.openqa.selenium.chrome.ChromeDriver)

Example 54 with WebDriver

use of org.openqa.selenium.WebDriver in project java.webdriver by sayems.

the class ImplicitWaitTime method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    driver.get("www.google.com");
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver)

Example 55 with WebDriver

use of org.openqa.selenium.WebDriver in project java.webdriver by sayems.

the class GetAttributes method main.

public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    WebElement searchButton = driver.findElement(By.name("btnK"));
    System.out.println("Name of the button is: " + searchButton.getAttribute("name"));
    System.out.println("Id of the button is: " + searchButton.getAttribute("id"));
    System.out.println("Class of the button is: " + searchButton.getAttribute("class"));
    System.out.println("Label of the button is: " + searchButton.getAttribute("aria-  label"));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) WebElement(org.openqa.selenium.WebElement)

Aggregations

WebDriver (org.openqa.selenium.WebDriver)167 WebElement (org.openqa.selenium.WebElement)87 Test (org.junit.Test)61 FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)59 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)40 Actions (org.openqa.selenium.interactions.Actions)25 IOException (java.io.IOException)12 Cookie (org.openqa.selenium.Cookie)11 List (java.util.List)10 File (java.io.File)9 HttpRequestCallback (ghostdriver.server.HttpRequestCallback)8 HttpServletRequest (javax.servlet.http.HttpServletRequest)8 HttpServletResponse (javax.servlet.http.HttpServletResponse)8 JavascriptExecutor (org.openqa.selenium.JavascriptExecutor)8 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)7 ExpectedCondition (org.openqa.selenium.support.ui.ExpectedCondition)7 By (org.openqa.selenium.By)5 Dimension (org.openqa.selenium.Dimension)5 Predicate (com.google.common.base.Predicate)4 TimeoutException (org.openqa.selenium.TimeoutException)4