List of usage examples for org.openqa.selenium WebDriver getCurrentUrl
String getCurrentUrl();
From source file:org.jboss.forge.scaffold.angularjs.scenario.dronetests.helpers.HasLandedOnSearchAddressView.java
License:Open Source License
@Override public Boolean apply(WebDriver driver) { return driver.getCurrentUrl().endsWith("/Addresss") && driver.findElement(By.id("Create")).isEnabled(); }
From source file:org.jboss.forge.scaffold.angularjs.scenario.dronetests.helpers.HasLandedOnSearchCustomerView.java
License:Open Source License
@Override public Boolean apply(WebDriver driver) { return driver.getCurrentUrl().endsWith("/Customers") && driver.findElement(By.id("Create")).isEnabled(); }
From source file:org.jboss.forge.scaffold.angularjs.scenario.dronetests.helpers.HasLandedOnSearchGroupIdentityView.java
License:Open Source License
@Override public Boolean apply(WebDriver driver) { return driver.getCurrentUrl().endsWith("/GroupIdentitys") && driver.findElement(By.id("Create")).isEnabled(); }
From source file:org.jboss.forge.scaffold.angularjs.scenario.dronetests.helpers.HasLandedOnSearchStoreOrderView.java
License:Open Source License
@Override public Boolean apply(WebDriver driver) { return driver.getCurrentUrl().endsWith("/StoreOrders") && driver.findElement(By.id("Create")).isEnabled(); }
From source file:org.jboss.forge.scaffold.angularjs.scenario.dronetests.helpers.HasLandedOnSearchUserIdentityView.java
License:Open Source License
@Override public Boolean apply(WebDriver driver) { return driver.getCurrentUrl().endsWith("/UserIdentitys") && driver.findElement(By.id("Create")).isEnabled(); }
From source file:org.jenkinsci.test.acceptance.po.Action.java
License:Open Source License
@Override public WebDriver open() { WebDriver wd = super.open(); if (!wd.getCurrentUrl().startsWith(url.toString())) { throw new AssertionError("Action " + url + " does not exist. Redirected to " + wd.getCurrentUrl()); }// w w w. j a va2s . c o m return wd; }
From source file:org.jenkinsci.test.acceptance.selenium.SanityChecker.java
License:Open Source License
private void checkSanity(WebDriver driver) { if (isFastPath(driver)) return;// w w w. j a va2s . co m // Exception List<WebElement> elements = driver.findElements(SPECIFIER); if (!elements.isEmpty()) { String trace = elements.get(0).getText(); if (trace.contains("<j:forEach> java.util.ConcurrentModificationException")) { // Do not report JENKINS-22553 as it is recoverable and fails dozens of tests return; } throw new AssertionError("Jenkins error detected:\n" + trace); } // POST required WebElement postForm = driver.findElement(By.cssSelector("form > input[value='Try POSTing']")); if (postForm != null) throw new AssertionError("Post required at " + driver.getCurrentUrl()); }
From source file:org.jitsi.meet.test.EndConferenceTest.java
License:Apache License
/** * Hang up the call and check if we're redirected to the main page. *//*from w ww .j a va 2 s.c o m*/ public void hangupCallAndCheck() { System.err.println("Start hangupCallAndCheck."); final WebDriver owner = ConferenceFixture.getOwner(); final String url = owner.getCurrentUrl(); // hangup and wait for redirect MeetUIUtils.clickOnToolbarButton(owner, "toolbar_button_hangup"); TestUtils.waitForCondition(owner, 5, new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return !url.equals(owner.getCurrentUrl()); } }); // Close the owner, as the welcome page is not a state recognized // by the ConferenceFixture and it will fail to figure out that // the owner must be restarted in case any tests are to follow // the EndConferenceTest. // It simpler to close it than implement extra state which would not // be of much use. ConferenceFixture.close(owner); }
From source file:org.keycloak.testsuite.adapter.AdapterTestStrategy.java
License:Open Source License
protected void loginAndCheckSession(WebDriver driver, LoginPage loginPage) { driver.navigate().to(APP_SERVER_BASE_URL + "/session-portal"); String currentUrl = driver.getCurrentUrl(); Assert.assertTrue(currentUrl.startsWith(LOGIN_URL)); loginPage.login("bburke@redhat.com", "password"); System.out.println("Current url: " + driver.getCurrentUrl()); Assert.assertEquals(driver.getCurrentUrl(), APP_SERVER_BASE_URL + "/session-portal" + slash); String pageSource = driver.getPageSource(); Assert.assertTrue(pageSource.contains("Counter=1")); // Counter increased now driver.navigate().to(APP_SERVER_BASE_URL + "/session-portal"); pageSource = driver.getPageSource(); Assert.assertTrue(pageSource.contains("Counter=2")); }
From source file:org.keycloak.testsuite.adapter.servlet.AbstractSessionServletAdapterTest.java
License:Apache License
private void loginAndCheckSession(WebDriver driver, Login login) { sessionPortalPage.navigateTo();//from ww w .j av a 2s . c o m assertCurrentUrlStartsWithLoginUrlOf(testRealmPage); login.form().login("bburke@redhat.com", "password"); assertEquals(driver.getCurrentUrl(), sessionPortalPage.toString()); String pageSource = driver.getPageSource(); assertTrue(pageSource.contains("Counter=1")); // Counter increased now sessionPortalPage.navigateTo(); pageSource = driver.getPageSource(); assertTrue(pageSource.contains("Counter=2")); }