| Navigation Commands: | ||||
|---|---|---|---|---|
| command | description | example | ||
| fetch url, load url, fetch 'http;//www.ebay.com/' | ||||
| fill_textfield field name, value | enter value in text field | fill_textfield 'satitle','ipod' | ||
| submit | submit button | |||
| click_link link name | to click any link | click_link 'Apple iPod' | ||
| Patterns : | ||||
|---|---|---|---|---|
| next_page link_name, :limit => 5 | go to next page-limit is no of page to go | next_page 'Next >', :limit => 5 | ||
| job_link "/a" do | ||||
| link "href" , :type => :attribute | ||||
| job_details do | ||||
| job "//div[@class='description']" | ||||
| end | ||||
| Next Page Pattern Examples: | ||
|---|---|---|
| written as | finds link with text | |
| next_page "Next »" | Next ยป | |
| next_page "Next >" | Next > | |
| next_page "Next 'test'" | Next 'test' | |
| next_page 'Next "test"' | Next "test" | |
| next_page "Next &" | Next & | |
| next_page "Next >" | Next > | |
| next_page "Next <" | Next < | |
| tmp 'Next >', :generalize => false do | next_page_url will be used to navigate to next page | |
| next_page_url "href", :type => :attribute | ||
| end | ||
| tmp "/title" do | text before : will become title and after : is company | |
| title /:(.*)/ | ||
| company /(.*):/ | ||
| end | ||
| company "/TD Bank Financial Group", :type => :constant | add constant to the output | |
| Stop Conditions: | ||
|---|---|---|
| ensure_stop_on_match(/7 days ago/) | stop if 7 days ago matched | |
| ensure_stop_on_days_ago(7) | stop fetching data older than 7 days | |