Search in sources :

Example 11 with FirefoxDriver

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

the class GoogleSearch method main.

public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    WebElement searchBox = driver.findElement(By.name("q"));
    searchBox.sendKeys("Selenium");
    searchBox.submit();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) WebElement(org.openqa.selenium.WebElement)

Example 12 with FirefoxDriver

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

the class LoadCookieInfo method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.facebook.com");
    try {
        File f2 = new File("browser.data");
        FileReader fr = new FileReader(f2);
        BufferedReader br = new BufferedReader(fr);
        String line;
        while ((line = br.readLine()) != null) {
            StringTokenizer str = new StringTokenizer(line, ";");
            while (str.hasMoreTokens()) {
                String name = str.nextToken();
                String value = str.nextToken();
                String domain = str.nextToken();
                String path = str.nextToken();
                Date expiry = null;
                String dt;
                if (!(dt = str.nextToken()).equals("null")) {
                    expiry = new Date(dt);
                }
                boolean isSecure = new Boolean(str.nextToken()).booleanValue();
                Cookie ck = new Cookie(name, value, domain, path, expiry, isSecure);
                driver.manage().addCookie(ck);
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    driver.get("http://www.facebook.com");
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Cookie(org.openqa.selenium.Cookie) StringTokenizer(java.util.StringTokenizer) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) BufferedReader(java.io.BufferedReader) FileReader(java.io.FileReader) File(java.io.File) Date(java.util.Date)

Example 13 with FirefoxDriver

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

the class ClickOnWebElement2 method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/Selectable.html");
    WebElement one = driver.findElement(By.name("one"));
    WebElement eleven = driver.findElement(By.name("eleven"));
    WebElement five = driver.findElement(By.name("five"));
    Actions builder = new Actions(driver);
    // Click on One, Eleven and Five
    builder.click(one).click(eleven).click(five);
    builder.build().perform();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement)

Example 14 with FirefoxDriver

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

the class ContextClick method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/ContextClick.html");
    WebElement contextMenu = driver.findElement(By.id("div-context"));
    Actions builder = new Actions(driver);
    builder.contextClick(contextMenu).click(driver.findElement(By.name("Item 4"))).perform();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement)

Example 15 with FirefoxDriver

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

the class DoubleClick2 method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("file://C:/DoubleClick.html");
    WebElement dblClick = driver.findElement(By.name("dblClick"));
    Actions builder = new Actions(driver);
    builder.moveToElement(dblClick).doubleClick().perform();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) Actions(org.openqa.selenium.interactions.Actions) WebElement(org.openqa.selenium.WebElement)

Aggregations

FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)77 WebDriver (org.openqa.selenium.WebDriver)59 WebElement (org.openqa.selenium.WebElement)46 Actions (org.openqa.selenium.interactions.Actions)18 FirefoxProfile (org.openqa.selenium.firefox.FirefoxProfile)9 File (java.io.File)8 FirefoxBinary (org.openqa.selenium.firefox.FirefoxBinary)5 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)5 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)4 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)4 URL (java.net.URL)3 Before (org.junit.Before)3 Test (org.junit.Test)3 PublicAtsApi (com.axway.ats.common.PublicAtsApi)2 FileReader (java.io.FileReader)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 BeforeClass (org.junit.BeforeClass)2 Cookie (org.openqa.selenium.Cookie)2