Dashboard > DDSteps Website > ... > DDSteps - Data Driven Sanity > DDSteps NavigateToOwner.java
  DDSteps Website Log In | Sign Up   View a printable version of the current page.  
  DDSteps NavigateToOwner.java
Added by Björn Granvik, last edited by Björn Granvik on Jan 18, 2006
Labels: 
(None)

/* NavigateToOwner.java
 * 
 * DDSteps - Data Driven JUnit Test Steps
 * Copyright (C) 2005 Jayway AB
 * www.ddsteps.org
 * 
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1 as published by the Free Software Foundation.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, visit 
 * http://www.opensource.org/licenses/lgpl-license.php
 */

package org.ddsteps.examples.petclinic.owner.navigators;

import org.ddsteps.jwebunit.WebBrowser;
import org.ddsteps.step.jwebunit.JWebUnitTestStep;

/**
 * Surf to to the owner page.
 * 
 * @author adam
 * @version $Id: NavigateToOwner.java,v 1.1 2005/12/03 12:56:13 adamskogman Exp $
 */
public class NavigateToOwner extends JWebUnitTestStep {

    protected String name;

    /**
     * @param webBrowser
     */
    public NavigateToOwner(WebBrowser webBrowser) {
        super(webBrowser);
    }

    /**
     * @see org.ddsteps.step.TestStep#runStep()
     */
    public void runStep() throws Exception {

        beginAt("/");

        // At the first page ----
        writeTrail("Home");

        // Link with text "Find owners"
        clickLinkWithText("Find owner");

        // At the find owners form ----
        writeTrail("Find Owners Form");

        // Button with label "Find Owners"
        // Use just plain submit, since the button has no name="xxx" attribute.
        // JWebUnit is not all that good with submit buttons...
        submit();

        // At the list of all owners ----
        writeTrail("List of all owners");

        // Click the button with the full name on it

        // This is a work-around too, since we cannot click submit buttons by label
        // EVEN if the javadoc on the JWebUnit site says we can... Weird thing:
        // the submit(String,String) method is just plain MISSING in the jar version of the file (found in JWebUnit 1.2)
        // Since they are going to need help from HttpUnit, this is not so strange, but the should pull it from the
        // javadoc...
        setWorkingForm(name);
        submit();

    }

    /**
     * @return Returns the name.
     */
    public String getName() {
        return name;
    }

    /**
     * @param name The name to set.
     */
    public void setName(String name) {
        this.name = name;
    }

}

Are you enjoying Confluence? Please consider purchasing it today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2 Build:#512 Apr 26, 2006) - Bug/feature request - Contact Administrators