Example usage for org.openqa.selenium WebDriver navigate

List of usage examples for org.openqa.selenium WebDriver navigate

Introduction

In this page you can find the example usage for org.openqa.selenium WebDriver navigate.

Prototype

Navigation navigate();

Source Link

Document

An abstraction allowing the driver to access the browser's history and to navigate to a given URL.

Usage

From source file:org.kie.page.objects.LoginPage.java

License:Apache License

public LoginPage(WebDriver driver) {
    this.driver = driver;

    driver.navigate().to(KIESeleniumTest.KIE_URL);

    wait = new FluentWait(driver).withTimeout(30, TimeUnit.SECONDS).pollingEvery(2, TimeUnit.SECONDS);
}

From source file:org.mozilla.zest.core.v1.ZestClientWindowOpenUrl.java

License:Mozilla Public License

@Override
public String invoke(ZestRuntime runtime) throws ZestClientFailException {
    WebDriver wd = runtime.getWebDriver(this.getWindowHandle());

    if (wd == null) {
        // No point throwing an exception as we were going to close it anyway
        return null;
    }/*from w w w.  ja  v a  2 s .c  om*/

    String targetUrl = runtime.replaceVariablesInString(url, true);
    wd.navigate().to(targetUrl);

    return targetUrl;
}

From source file:org.olat.selenium.CourseTest.java

License:Apache License

/**
 * An author create a course with a blog, open it, add a post.
 * A student open the course, see the blog post. An administrator
 * clears the feed cache. The author add a new post, the student
 * must see it.//from  w  w  w. ja v a  2  s.com
 * 
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void blogWithClearCache(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver participantDrone,
        @Drone @Administrator WebDriver administratorDrone) throws IOException, URISyntaxException {

    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");

    loginPage.loginAs(author.getLogin(), author.getPassword());

    //create a course with a blog
    String courseTitle = "Course-Blog-1-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();

    String blogNodeTitle = "Blog-RW-1";
    String blogTitle = "Blog - RW - " + UUID.randomUUID().toString();

    //create a course element of type blog with a blog
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("blog").nodeTitle(blogNodeTitle).selectTabLearnContent().createFeed(blogTitle);
    //publish the course
    courseEditor.publish().quickPublish();

    //open the course and see the blog
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(blogNodeTitle);

    String postTitle = "Blog-RW-1-" + UUID.randomUUID();
    String postSummary = "Some explantations as teaser";
    String postContent = "Content of the post";
    FeedPage feed = FeedPage.getFeedPage(browser);
    feed.newBlog().fillPostForm(postTitle, postSummary, postContent).publishPost();

    //participant go to the blog
    participantDrone.navigate().to(deploymentUrl);
    LoginPage participantLogin = LoginPage.getLoginPage(participantDrone, deploymentUrl);
    participantLogin.loginAs(participant.getLogin(), participant.getPassword());
    //search the course in "My courses"
    NavigationPage participantNavigation = new NavigationPage(participantDrone);
    participantNavigation.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
    //Navigate the course to the blog
    CoursePageFragment participantCourse = new CoursePageFragment(participantDrone);
    participantCourse.clickTree().selectWithTitle(blogNodeTitle);
    FeedPage participantFeed = FeedPage.getFeedPage(participantDrone);
    participantFeed.assertOnBlogPost(postTitle);

    //administrator clears the cache
    administratorDrone.navigate().to(deploymentUrl);
    LoginPage.getLoginPage(administratorDrone, deploymentUrl).loginAs("administrator", "openolat");
    new NavigationPage(administratorDrone).openAdministration().clearCache("FeedManager@feed");

    //the author publish a second post in its blog
    String post2Title = "Blog-RW-2-" + UUID.randomUUID();
    String post2Summary = "Some explantations as teaser";
    String post2Content = "Content of the post";
    feed.addPost().fillPostForm(post2Title, post2Summary, post2Content).publishPost();

    //the participant must see the new post after some click
    participantFeed.clickFirstMonthOfPager().assertOnBlogPost(post2Title);
}

From source file:org.olat.selenium.page.course.CoursePageFragment.java

License:Apache License

public static CoursePageFragment getCourse(WebDriver browser, URL deploymentUrl, CourseVO course) {
    browser.navigate().to(deploymentUrl.toExternalForm() + "url/RepositoryEntry/" + course.getRepoEntryKey());
    OOGraphene.waitElement(courseRun, browser);
    return new CoursePageFragment(browser);
}

From source file:org.openecomp.sdc.ci.tests.execute.setup.SetupCDTest.java

License:Open Source License

public static void navigateToUrl(String url) throws Exception {

    try {//  w  w  w  .ja v  a 2  s  .  c  om
        WebDriver driver = GeneralUIUtils.getDriver();
        System.out.println("navigating to URL :" + url);
        driver.manage().window().maximize();
        driver.manage().deleteAllCookies();
        driver.navigate().to(url);
        GeneralUIUtils.windowZoomOut();
        GeneralUIUtils.waitForLoader();
    } catch (Exception e) {
        System.out.println("browser is unreachable");
        extendTest.log(LogStatus.ERROR, "browser is unreachable");
        Assert.fail("browser is unreachable");
    }
}

From source file:org.specrunner.webdriver.AbstractPluginNavigation.java

License:Open Source License

@Override
protected void doEnd(IContext context, IResultSet result, WebDriver client) throws PluginException {
    doEnd(context, result, client, client.navigate());
}

From source file:org.wso2.appmanager.ui.integration.test.pages.PublisherWebAppsListPage.java

License:Open Source License

/**
 * Change the lifecylce state of given web app from current state to
 * given state./*from w ww.jav  a  2 s .  c om*/
 * @param webAppName App Name
 * @param provider Provider
 * @param version Version
 * @param state Lifecycle state
 * @param driver Web driver
 */
public void changeLifeCycleState(String webAppName, String provider, String version, String state,
        WebDriver driver) {
    WebDriverWait wait = new WebDriverWait(driver, 120);
    wait.until(ExpectedConditions
            .visibilityOfElementLocated(By.cssSelector("[data-name='" + webAppName + "'][data-action='" + state
                    + "']" + "[data-provider='" + provider + "'][data-version='" + version + "']")));
    driver.findElement(By.cssSelector("[data-name='" + webAppName + "'][data-action='" + state + "']"
            + "[data-provider='" + provider + "'][data-version='" + version + "']")).click();
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[data-dismiss='modal']")));
    driver.findElement(By.cssSelector("[data-dismiss='modal']")).click();
    driver.navigate().refresh();
}

From source file:org.wso2.appmanager.ui.integration.test.pages.PublisherWebAppsListPage.java

License:Open Source License

/**
 * Delete the webapp/*ww w. j a v  a  2s  .c o m*/
 * @param webAppName App Name
 * @param provider Provider
 * @param version Version
 * @param driver Web driver
 */
public boolean deleteApp(String webAppName, String provider, String version, WebDriver driver) {

    boolean present;
    try {
        WebDriverWait wait = new WebDriverWait(driver, 120);
        wait.until(ExpectedConditions.visibilityOfElementLocated(
                By.cssSelector("[data-name='" + webAppName + "']" + "[data-provider='" + provider
                        + "'][data-version='" + version + "']" + "[value='Delete']")));
        driver.findElement(By.cssSelector("[data-name='" + webAppName + "']" + "[data-provider='" + provider
                + "'][data-version='" + version + "']" + "[value='Delete']")).click();
        driver.switchTo().alert().accept();
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("[data-dismiss='modal']")));
        driver.findElement(By.cssSelector("[data-dismiss='modal']")).click();
        driver.navigate().refresh();
        present = true;
    } catch (NoSuchElementException e) {
        present = false;
    }
    return present;
}

From source file:org.xframium.gesture.device.action.spi.perfecto.BackAction.java

License:Open Source License

@Override
public boolean _executeAction(WebDriver webDriver, List<Object> parameterList) {
    webDriver.navigate().back();
    return true;/*ww w.jav  a2s . c  om*/
}

From source file:org.xframium.gesture.device.action.spi.perfecto.URLAction.java

License:Open Source License

@Override
public boolean _executeAction(WebDriver webDriver, List<Object> parameterList) {
    webDriver.navigate().to(parameterList.get(0) + "");
    return true;/*  w  ww  . ja v  a  2 s.  com*/
}