Search in sources :

Example 66 with FirefoxDriver

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

the class ByLinkText method main.

public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    WebElement aboutLink = driver.findElement(By.linkText("About Google"));
    aboutLink.click();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) WebElement(org.openqa.selenium.WebElement)

Example 67 with FirefoxDriver

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

the class ByName method main.

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

Example 68 with FirefoxDriver

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

the class ByPartialLinkText method main.

public static void main(String[] args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.google.com");
    WebElement aboutLink = driver.findElement(By.partialLinkText("About"));
    aboutLink.click();
}
Also used : WebDriver(org.openqa.selenium.WebDriver) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) WebElement(org.openqa.selenium.WebElement)

Example 69 with FirefoxDriver

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

the class StoreCookieInfo method main.

public static void main(String... args) {
    WebDriver driver = new FirefoxDriver();
    driver.get("http://www.facebook.com");
    driver.findElement(By.name("email")).sendKeys("<<ur mailID>>");
    driver.findElement(By.name("pass")).sendKeys("<<ur password>>");
    driver.findElement(By.name("persistent")).click();
    driver.findElement(By.name("pass")).submit();
    File f = new File("browser.data");
    try {
        f.delete();
        f.createNewFile();
        FileWriter fos = new FileWriter(f);
        BufferedWriter bos = new BufferedWriter(fos);
        for (Cookie ck : driver.manage().getCookies()) {
            bos.write((ck.getName() + ";" + ck.getValue() + ";" + ck.getDomain() + ";" + ck.getPath() + ";" + ck.getExpiry() + ";" + ck.isSecure()));
            bos.newLine();
        }
        bos.flush();
        bos.close();
        fos.close();
    } catch (Exception ex) {
        ex.printStackTrace();
    }
}
Also used : WebDriver(org.openqa.selenium.WebDriver) Cookie(org.openqa.selenium.Cookie) FirefoxDriver(org.openqa.selenium.firefox.FirefoxDriver) FileWriter(java.io.FileWriter) File(java.io.File) BufferedWriter(java.io.BufferedWriter)

Example 70 with FirefoxDriver

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

the class ContextClick2 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.moveToElement(contextMenu).contextClick().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)

Aggregations

FirefoxDriver (org.openqa.selenium.firefox.FirefoxDriver)82 WebDriver (org.openqa.selenium.WebDriver)61 WebElement (org.openqa.selenium.WebElement)47 Actions (org.openqa.selenium.interactions.Actions)18 FirefoxProfile (org.openqa.selenium.firefox.FirefoxProfile)10 File (java.io.File)8 ChromeDriver (org.openqa.selenium.chrome.ChromeDriver)7 FirefoxBinary (org.openqa.selenium.firefox.FirefoxBinary)6 RemoteWebDriver (org.openqa.selenium.remote.RemoteWebDriver)5 WebDriverWait (org.openqa.selenium.support.ui.WebDriverWait)5 URL (java.net.URL)4 Before (org.junit.Before)4 PhantomJSDriver (org.openqa.selenium.phantomjs.PhantomJSDriver)4 Test (org.junit.Test)3 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)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