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();
}
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");
}
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();
}
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();
}
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();
}
Aggregations