Skip to content

Commit

Permalink
adding set_url and load details
Browse files Browse the repository at this point in the history
  • Loading branch information
natritmeyer committed Apr 17, 2012
1 parent 46eacb9 commit e78ce04
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions README.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -48,8 +48,48 @@ element that can then be acted upon (clicked, set text value), or
queried (is it enabled? visible?). queried (is it enabled? visible?).


SitePrism is based around this concept, but goes further as you'll see SitePrism is based around this concept, but goes further as you'll see
below. below by also allowing modelling of repeated sections that appear on
muliple pages, or many times on a page using the concept of sections.


### Pages ## Pages


As you might be able to guess from the name, pages are fairly central to
the Page Object Model. Here's how SitePrism models them:

### Creating a Page Model

The simplest page is one that has nothing defined in it. Here's an
example of how to begin modelling a home page:

```ruby
class Home < SitePrism::Page

end
```

The above has nothing useful defined, only the name.

### Adding a URL

A page usually has a URL. If you want to be able to navigate to a page,
you'll need to set its URL. Here's how:

```ruby
class Home < SitePrism::Page
set_url "http://www.google.com"
end
```

### Navigating to the Page

Once the URL has been set (using `set_url`), you can navigate directly
to the page using `#load`:

```ruby
home = Home.new
home.load
```

This will tell which ever capybara driver you have configured to
navigate to the URL set against that page's class.


0 comments on commit e78ce04

Please sign in to comment.