@Override public void refresh() { driver.navigate().refresh(); }
@Override public void before() throws Throwable { setUpWebDriver(); try { driver.get(getPulseURL() + "login.html"); } catch (Exception e) { e.printStackTrace(); System.out.println("before: driver get exception " + e.getMessage()); throw e; } if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) { try { login(); } catch (Exception e) { e.printStackTrace(); System.out.println("before: login exception " + e.getMessage()); throw e; } } driver.navigate().refresh(); }
public void refresh(Driver driver) { driver.getWebDriver().navigate().refresh(); } }
public void back(Driver driver) { driver.getWebDriver().navigate().back(); }
public void forward(Driver driver) { driver.getWebDriver().navigate().forward(); }
@Test public void testAccountChooserPopulatesUsernameNotEmailWhenOriginIsUAAorLDAP() throws Exception { String userUAA = "{\"userId\":\"1\",\"username\":\"userUAA\",\"origin\":\"uaa\",\"email\":\"user@uaa.org\"}"; String userLDAP = "{\"userId\":\"2\",\"username\":\"userLDAP\",\"origin\":\"ldap\",\"email\":\"user@ldap.org\"}"; String userExternal = "{\"userId\":\"3\",\"username\":\"userExternal\",\"origin\":\"external\",\"email\":\"user@external.org\"}"; String zoneUrl = createDiscoveryZone(); webDriver.get(zoneUrl); webDriver.manage().deleteAllCookies(); JavascriptExecutor js = (JavascriptExecutor) webDriver; js.executeScript("document.cookie = \"Saved-Account-1=" + URLEncoder.encode(userUAA, StandardCharsets.UTF_8.name()) + ";path=/;domain=testzone3.localhost\""); js.executeScript("document.cookie = \"Saved-Account-2=" + URLEncoder.encode(userLDAP, StandardCharsets.UTF_8.name()) + ";path=/;domain=testzone3.localhost\""); js.executeScript("document.cookie = \"Saved-Account-3=" + URLEncoder.encode(userExternal, StandardCharsets.UTF_8.name()) + ";path=/;domain=testzone3.localhost\""); webDriver.navigate().refresh(); assertEquals(3, webDriver.findElements(By.cssSelector("span.email-address")).size()); webDriver.findElement(By.xpath("//span[contains(text(), 'userUAA')]")).click(); assertEquals("userUAA", webDriver.findElement(By.id("username")).getAttribute("value")); webDriver.navigate().back(); webDriver.findElement(By.xpath("//span[contains(text(), 'userLDAP')]")).click(); assertEquals("userLDAP", webDriver.findElement(By.id("username")).getAttribute("value")); webDriver.navigate().back(); webDriver.findElement(By.xpath("//span[contains(text(), 'userExternal')]")).click(); assertEquals("user@external.org", webDriver.findElement(By.id("username")).getAttribute("value")); webDriver.manage().deleteAllCookies(); }
@Test public void testBannerFunctionalityInDiscoveryPage() { String zoneId = "testzone3"; RestTemplate identityClient = IntegrationTestUtils.getClientCredentialsTemplate( IntegrationTestUtils.getClientCredentialsResource(baseUrl, new String[]{"zones.write", "zones.read", "scim.zones"}, "identity", "identitysecret") ); IdentityZoneConfiguration config = new IdentityZoneConfiguration(); config.setIdpDiscoveryEnabled(true); Banner banner = new Banner(); banner.setText("test banner"); banner.setBackgroundColor("#444"); banner.setTextColor("#111"); config.setBranding(new BrandingInformation()); config.getBranding().setBanner(banner); IntegrationTestUtils.createZoneOrUpdateSubdomain(identityClient, baseUrl, zoneId, zoneId, config); String zoneUrl = baseUrl.replace("localhost",zoneId+".localhost"); webDriver.get(zoneUrl); webDriver.manage().deleteAllCookies(); webDriver.navigate().refresh(); assertEquals("test banner", webDriver.findElement(By.cssSelector(".banner-header span")).getText()); assertEquals("rgba(68, 68, 68, 1)", webDriver.findElement(By.cssSelector(".banner-header")).getCssValue("background-color")); assertEquals("rgba(17, 17, 17, 1)", webDriver.findElement(By.cssSelector(".banner-header span")).getCssValue("color")); String base64Val = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAATBJREFUeNqk008og3Ecx/HNnrJSu63kIC5qKRe7KeUiOSulTHJUTrsr0y5ycFaEgyQXElvt5KDYwU0uO2hSUy4KoR7v7/qsfmjPHvzq1e/XU8/39/3zPFHf9yP/WV7jED24nGRbxDFWUAsToM05zyKFLG60d/wmQBxWzwyOlMU1phELEyCmtPeRQRoVbKOM0VYB6q0QW+3IYQpJFFDEYFCAiMqwNY857Ko3SxjGBTbRXb+xMUamcMbWh148YwJvOHSCdyqTAdxZo72ADGwKT98C9CChcxUPQSVYLz50toae4Fy9WcAISl7AiN/RhS1N5RV5rOLxx5eom90pvGAI/VjHMm6bfspK18a1gXvsqM41XDVL052C1Tim56cYd/rR+mdSrXGluxfm5S8Z/HV9CjAAvQZLXoa5mpgAAAAASUVORK5CYII="; banner.setLogo(base64Val); IntegrationTestUtils.createZoneOrUpdateSubdomain(identityClient, baseUrl, zoneId, zoneId, config); webDriver.get(zoneUrl); assertEquals("data:image/png;base64," + base64Val, webDriver.findElement(By.cssSelector(".banner-header img")).getAttribute("src")); assertEquals(2, webDriver.findElement(By.cssSelector(".banner-header")).findElements(By.xpath(".//*")).size()); }
@Test public void testBannerBackgroundIsHiddenIfNoTextOrImage() { String zoneId = "testzone3"; RestTemplate identityClient = IntegrationTestUtils.getClientCredentialsTemplate( IntegrationTestUtils.getClientCredentialsResource(baseUrl, new String[]{"zones.write", "zones.read", "scim.zones"}, "identity", "identitysecret") ); IdentityZoneConfiguration config = new IdentityZoneConfiguration(); config.setIdpDiscoveryEnabled(true); Banner banner = new Banner(); banner.setLink("http://example.com"); banner.setBackgroundColor("#444"); banner.setTextColor("#111"); config.setBranding(new BrandingInformation()); config.getBranding().setBanner(banner); IntegrationTestUtils.createZoneOrUpdateSubdomain(identityClient, baseUrl, zoneId, zoneId, config); String zoneUrl = baseUrl.replace("localhost",zoneId+".localhost"); webDriver.get(zoneUrl); webDriver.manage().deleteAllCookies(); webDriver.navigate().refresh(); assertEquals(0, webDriver.findElements(By.cssSelector(".banner-header")).size()); }
private void navigateTo(SelenideDriver driver, String url, AuthenticationType authenticationType, String domain, String login, String password) { checkThatProxyIsEnabled(driver.config()); url = absoluteUrl(driver.config(), url); url = appendBasicAuthIfNeeded(driver.config(), url, authenticationType, domain, login, password); SelenideLog log = SelenideLogger.beginStep("open", url); try { WebDriver webDriver = driver.getAndCheckWebDriver(); beforeNavigateTo(driver.config(), driver.getProxy(), authenticationType, domain, login, password); webDriver.navigate().to(url); SelenideLogger.commitStep(log, PASS); } catch (WebDriverException e) { SelenideLogger.commitStep(log, e); e.addInfo("selenide.url", url); e.addInfo("selenide.baseUrl", driver.config().baseUrl()); throw e; } catch (RuntimeException | Error e) { SelenideLogger.commitStep(log, e); throw e; } }
@Override public void beforeRetry() { browser.driver.navigate().back(); } });
/** Equivalent to pressing the 'back' button of the browser. <br> * Fails if the page content does not match content expected in a page of * the type indicated by the parameter {@code typeOfPreviousPage}. */ public <T extends AppPage> T goToPreviousPage(Class<T> typeOfPreviousPage) { browser.driver.navigate().back(); waitForPageToLoad(); return changePageType(typeOfPreviousPage); }
@Override public Navigation navigate() { // TODO Auto-generated method stub return driver.navigate(); }
@Nonnull @Override public BrowserEngine reloadPage() { webDriver.navigate().refresh(); return this; }
@Override public Boolean apply(WebDriver driver) { driver.navigate().refresh(); return Boolean.valueOf(pattern.matcher(getContent()).matches()); } });
public void to(String path) { if (path.contains("://")) { driver.get(path); } else { try { URL url = new URL(new URL(config.getHome()), path); driver.navigate().to(url); } catch (MalformedURLException e) { throw new WebDriverException(e); } } }
/** * Go back in browser. */ public void navigateBack() { getDriver().navigate().back(); Messager.BACK.info(); }
/** * Refresh browser. */ public void refresh() { getDriver().navigate().refresh(); Messager.REFRESH.info(); }
public Navigation navigate() { if (!isEnabled()) { return new NavigationStub(); } return getProxiedDriver().navigate(); }
/** * Go back to previous page */ @Step public void back() { invoker.doJAction("Go back to previous page", () -> getDriver().navigate().back()); }
@Test public void helloPageHasTextHelloWorld(){ driver.navigate().to(String.format("http://localhost:%s/hello", port)); WebElement body = driver.findElement(By.tagName("body")); assertThat(body.getText(), containsString("Hello World!")); } }