use of org.openqa.selenium.htmlunit.HtmlUnitDriver in project cucumber-jvm by cucumber.
the class RentACarSupport method getAvailableNumberOfCars.
public int getAvailableNumberOfCars() {
WebDriver driver = new HtmlUnitDriver();
try {
driver.get("http://localhost:9878/rentit/available");
WebElement availableCars = driver.findElement(By.id("availableCars"));
String availableCarsString = availableCars.getText();
return Integer.parseInt(availableCarsString);
} finally {
driver.close();
}
}
use of org.openqa.selenium.htmlunit.HtmlUnitDriver in project cucumber-jvm by cucumber.
the class RentACarSupport method rentACar.
public void rentACar() {
WebDriver driver = new HtmlUnitDriver();
try {
driver.get("http://localhost:9878/rentit/rent");
WebElement rentButton = driver.findElement(By.id("rentButton"));
rentButton.click();
} finally {
driver.close();
}
}
use of org.openqa.selenium.htmlunit.HtmlUnitDriver in project kotlin by JetBrains.
the class SeleniumTest method createDriver.
public static WebDriver createDriver() {
HtmlUnitDriver answer = new HtmlUnitDriverWithExceptionOnFailingStatusCode();
answer.setJavascriptEnabled(true);
return answer;
}
use of org.openqa.selenium.htmlunit.HtmlUnitDriver in project mamute by caelum.
the class AcceptanceTestBase method htmlUnitDriver.
@SuppressWarnings("unused")
private static WebDriver htmlUnitDriver() {
HtmlUnitDriver driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_24);
driver.setJavascriptEnabled(true);
return driver;
}
use of org.openqa.selenium.htmlunit.HtmlUnitDriver in project archiva by apache.
the class WebDriverBrowseTest method simpletest.
@Test
public void simpletest() throws Exception {
Properties p = new Properties();
p.load(this.getClass().getClassLoader().getResourceAsStream("test.properties"));
String baseUrl = WebdriverUtility.getBaseUrl();
String url = baseUrl + "/index.html?request_lang=en";
goTo(url);
// wait until topbar-menu-container is feeded
await().atMost(5, TimeUnit.SECONDS).untilPredicate((fl) -> $("#topbar-menu").present());
await().atMost(10, TimeUnit.SECONDS).untilPredicate((fl) -> el("#create-admin-link-a").conditions().clickable() || el("#login-link-a").conditions().clickable());
FluentList<FluentWebElement> elements = find("#create-admin-link-a");
if (!elements.isEmpty() && elements.get(0).displayed()) {
WebElement webElement = elements.get(0).getElement();
Assert.assertEquals("Create Admin User", webElement.getText());
webElement.click();
await().atMost(2, TimeUnit.SECONDS).untilPredicate((fl) -> $("#user-create").present());
assertThat(find("#username").value().equals("admin"));
assertThat(find("#password").value().isEmpty());
assertThat(find("#confirmPassword").value().isEmpty());
assertThat(find("#email").value().isEmpty());
$("#fullname").fill().with(p.getProperty("ADMIN_FULLNAME"));
$("#email").fill().with(p.getProperty("ADMIN_EMAIL"));
$("#password").fill().with(p.getProperty("ADMIN_PASSWORD"));
$("#confirmPassword").fill().with(p.getProperty("ADMIN_PASSWORD"));
find("#user-create-form-register-button").click();
await().atMost(2, TimeUnit.SECONDS).untilPredicate((fl) -> $("#logout-link").present());
FluentList<FluentWebElement> elementss = find("#menu-find-browse-a");
WebElement webElsement = elementss.get(0).getElement();
webElsement.click();
await().atMost(5, TimeUnit.SECONDS).untilPredicate((fl) -> $("#main_browse_result").present());
// give me search page :( not browse page
takeScreenShot("search.png");
goTo(baseUrl + "/index.html#browse?request_lang=en");
takeScreenShot("browse.png");
// give me a browse page
} else {
elements = find(By.id("login-link-a"));
WebElement webElement = elements.get(0).getElement();
if (getDriver() instanceof HtmlUnitDriver) {
Assert.assertEquals("LOGIN", webElement.getText().toUpperCase());
} else {
Assert.assertEquals("LOGIN", webElement.getText());
}
}
}
Aggregations