use of org.openqa.selenium.WebDriver in project ghostdriver by detro.
the class ElementMethodsTest method checkDisplayedOnGoogleSearchBox.
@Test
public void checkDisplayedOnGoogleSearchBox() {
WebDriver d = getDriver();
d.get("http://www.google.com");
WebElement el = d.findElement(By.cssSelector("input[name*='q']"));
assertTrue(el.isDisplayed());
el = d.findElement(By.cssSelector("input[type='hidden']"));
assertFalse(el.isDisplayed());
}
use of org.openqa.selenium.WebDriver in project webmagic by code4craft.
the class SeleniumTest method testSelenium.
@Ignore("need chrome driver")
@Test
public void testSelenium() {
System.getProperties().setProperty("webdriver.chrome.driver", "/Users/yihua/Downloads/chromedriver");
Map<String, Object> contentSettings = new HashMap<String, Object>();
contentSettings.put("images", 2);
Map<String, Object> preferences = new HashMap<String, Object>();
preferences.put("profile.default_content_settings", contentSettings);
DesiredCapabilities caps = DesiredCapabilities.chrome();
caps.setCapability("chrome.prefs", preferences);
caps.setCapability("chrome.switches", Arrays.asList("--user-data-dir=/Users/yihua/temp/chrome"));
WebDriver webDriver = new ChromeDriver(caps);
webDriver.get("http://huaban.com/");
WebElement webElement = webDriver.findElement(By.xpath("/html"));
System.out.println(webElement.getAttribute("outerHTML"));
webDriver.close();
}
use of org.openqa.selenium.WebDriver in project webmagic by code4craft.
the class WebDriverPoolTest method test.
@Ignore("need chrome driver")
@Test
public void test() {
System.getProperties().setProperty("webdriver.chrome.driver", chromeDriverPath);
WebDriverPool webDriverPool = new WebDriverPool(5);
for (int i = 0; i < 5; i++) {
try {
WebDriver webDriver = webDriverPool.get();
System.out.println(i);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
webDriverPool.closeAll();
}
use of org.openqa.selenium.WebDriver in project head by mifos.
the class SeleniumTest method testSearchMifosOnGoogle.
@Test
public void testSearchMifosOnGoogle() throws Exception {
WebDriver wd = new FirefoxDriver();
try {
wd.get("http://www.google.com");
WebElement element = wd.findElement(By.name("q"));
element.sendKeys("Mifos");
element.submit();
} finally {
wd.quit();
}
}
use of org.openqa.selenium.WebDriver in project head by mifos.
the class WorkspaceServerLauncherTest method testLogin.
@Test
public void testLogin() throws Exception {
WebDriver wd = new FirefoxDriver();
wd.get(getAppURL());
wd.findElement(By.id(UID)).sendKeys("mifos");
wd.findElement(By.id(PWD)).sendKeys("testmifos");
wd.findElement(By.id(BTN)).click();
Assert.assertTrue(wd.getPageSource().contains("Mifos"));
Assert.assertTrue(wd.getPageSource().contains("Home"));
Assert.assertTrue(wd.getPageSource().contains("Search"));
wd.quit();
}
Aggregations