List of usage examples for org.openqa.selenium WebDriver getCurrentUrl
String getCurrentUrl();
From source file:org.craftercms.cstudio.share.selenium.basic.CStudioSeleniumUtil.java
License:Open Source License
public static void try_login(WebDriver driver, String username, String password, boolean expected) { driver.get(properties.getProperty("share.login.url")); WebElement element = driver.findElement(By.name("username")); element.sendKeys(username);/*from w w w .j a v a 2 s.co m*/ element = driver.findElement(By.name("password")); element.sendKeys(password); element = driver.findElement(By.id("btn-login")); element.click(); assertEquals(driver.getCurrentUrl() .equals(String.format(properties.getProperty("user.dashboard.url"), username)), expected); }
From source file:org.craftercms.cstudio.share.selenium.basic.CStudioSeleniumUtil.java
License:Open Source License
public static void navigate_to_dashboard(WebDriver driver) { driver.navigate().to(properties.getProperty("acme.dashboard.url")); wait_until_displayed(driver, SHORT_TIMEOUT, By.id("acn-wcm-logo-image")); wait_until_displayed(driver, SHORT_TIMEOUT, By.id("acn-dropdown-toggler")); assertTrue(driver.getCurrentUrl().equals(properties.getProperty("acme.dashboard.url"))); }
From source file:org.craftercms.cstudio.share.selenium.basic.CStudioSeleniumUtil.java
License:Open Source License
public static void navigate_to_unauthorized_url(WebDriver driver, String username) { driver.navigate().to(properties.getProperty("acme.dashboard.url")); assertTrue(driver.getCurrentUrl() .equals(String.format(properties.getProperty("user.dashboard.url"), username))); }
From source file:org.craftercms.cstudio.share.selenium.basic.CStudioSeleniumUtil.java
License:Open Source License
private static void navigate_to(WebDriver driver, String url) { driver.navigate().to(url);/*www . j a va 2s .c o m*/ new WebDriverWait(driver, SHORT_TIMEOUT); assertTrue(driver.getCurrentUrl().equals(url)); }
From source file:org.craftercms.cstudio.share.selenium.basic.CStudioSeleniumUtil.java
License:Open Source License
public static void navigate_to_analytics_dashboard(WebDriver driver) { navigate_to(driver, properties.getProperty("acme.analytics.dashboard.url")); // Verify URL assertTrue(driver.getCurrentUrl().equals(properties.getProperty("acme.analytics.dashboard.url"))); // Wait for the page to load new WebDriverWait(driver, LONG_TIMEOUT).until(new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return d.findElements(By.tagName("iframe")).size() == 7; }//from w w w . j a va 2 s. c o m }); }
From source file:org.eclipse.packagedrone.testing.server.UserTest.java
License:Open Source License
private static Predicate<WebDriver> endsWith(final String urlSuffix) { return new Predicate<WebDriver>() { @Override/* ww w . j a v a 2 s . co m*/ public boolean apply(final WebDriver driver) { return driver.getCurrentUrl().endsWith(urlSuffix); } }; }
From source file:org.hepaces.surveyfeedbacktestscript.KrogerFeedbackManager.java
/** * Fills in the date and time fields/* w w w. jav a 2 s. c om*/ * @param date * @param browser */ public static void fillInDateAndTime(DateTime date, WebDriver browser) { logger.debug("Attempting to fill in the date and time inputs @:" + browser.getCurrentUrl()); try { //Date Inputs WebElement monthInput = browser.findElement(By.id(inputMonthId)); WebElement dayInput = browser.findElement(By.id(inputDayId)); WebElement yearInput = browser.findElement(By.id(inputYearId)); //Time Inputs WebElement hourInput = browser.findElement(By.id(inputHourId)); WebElement minuteInput = browser.findElement(By.id(inputMinuteId)); WebElement amPmInput = browser.findElement(By.id(inputAMPM)); //handle date inputs (year is prepopulated, so not handled) numericDropDownHandler(date.getMonthOfYear(), monthInput); numericDropDownHandler(date.getDayOfMonth(), dayInput); //handle time inputs numericDropDownHandler(date.get(DateTimeFieldType.clockhourOfHalfday()), hourInput); numericDropDownHandler(date.getMinuteOfHour(), minuteInput); numericDropDownHandler(date.get(DateTimeFieldType.halfdayOfDay()) + 1, amPmInput); } catch (Exception e) { } }
From source file:org.jboss.arquillian.ajocado.drone.factory.GrapheneWebDriverFactoryTestCase.java
License:Open Source License
@Test public void when_instantiator_creates_driver_instance_then_factory_set_it_to_context() { // given/*from w w w . j av a 2 s .c o m*/ given_instantiator_creates(realDriver); // when WebDriver createdDriver = factory.createInstance(configuration); createdDriver.getCurrentUrl(); // then assertTrue(GrapheneContext.isInitialized()); verify(realDriver, only()).getCurrentUrl(); }
From source file:org.jboss.arquillian.graphene.context.TestGrapheneProxyHandler.java
License:Open Source License
@Test public void test_webDriver_methods_which_should_not_return_proxy() { IsNotProxyable isNotProxyable = new IsNotProxyable(); // when//from w w w .j a v a2 s. co m WebDriver driver = Mockito.mock(WebDriver.class, isNotProxyable); Options options = mock(Options.class, isNotProxyable); Navigation navigation = mock(Navigation.class, isNotProxyable); ImeHandler ime = mock(ImeHandler.class, isNotProxyable); Logs logs = mock(Logs.class, isNotProxyable); // then try { driver.toString(); driver.close(); driver.equals(new Object()); driver.get(""); driver.getClass(); driver.getCurrentUrl(); driver.getPageSource(); driver.getTitle(); driver.getWindowHandle(); driver.hashCode(); driver.quit(); driver.toString(); options.addCookie(mock(Cookie.class)); options.deleteAllCookies(); options.deleteCookie(mock(Cookie.class)); options.deleteCookieNamed(""); options.getCookieNamed(""); navigation.back(); navigation.forward(); navigation.to(""); navigation.to(new URL("http://localhost/")); ime.activateEngine(""); ime.deactivate(); ime.getActiveEngine(); ime.isActivated(); logs.get(""); } catch (Exception e) { throw new RuntimeException(e); } assertEquals(Arrays.asList(), isNotProxyable.getViolations()); }
From source file:org.jboss.arquillian.jbehave.examples.client.ExchangeCurrenciesPage.java
License:Apache License
public ExchangeCurrenciesPage(WebDriver driver, URL contextRoot) { this.driver = driver; this.contextPath = contextRoot; Wait<WebDriver> wait = new WebDriverWait(driver, 15); wait.until(PageUtilities.visibilityOfElementLocated(By.id("inputForm"))); if (!driver.getCurrentUrl().equals(contextPath.toString()) && !driver.getCurrentUrl().equals(contextPath + PAGE_NAME)) { throw new IllegalStateException("This is not the Index page."); }/*from w w w.ja va2 s . c o m*/ }