use of org.openqa.selenium.WebDriver 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.WebDriver in project java.webdriver by sayems.
the class GetHeight 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");
driver.manage().window().setSize(new Dimension(1024, 768));
driver.quit();
}
use of org.openqa.selenium.WebDriver 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.WebDriver 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.WebDriver 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