Skip to content

Instantly share code, notes, and snippets.

@nhajratw
Created March 28, 2012 15:10
Show Gist options
  • Save nhajratw/2227011 to your computer and use it in GitHub Desktop.
Save nhajratw/2227011 to your computer and use it in GitHub Desktop.
trying to get the element() accessor of page_object to work.
The reason we're using "element" is because the html contains a "dl" element.
---------------
class HeaderInfo
include PageObject
element(:merchant, :id => 'merchant-name')
---
Cuke step contains:
Then /^I should see "([^"]*)"$/ do |value|
on_page(HeaderInfo).merchant.should == value
end
----
HTML
<div class="merchant-offer">
<dl>
<dt>Merchant:</dt>
<dd id="merchant-name"/>
</dl>
</div>
-----
error:
Then I should see merchant of "Namics AG" # features/step_definitions/header_steps.rb:1
can't clone NilClass (TypeError)
./features/support/pages/header_info.rb:7:in `merchant'
./features/step_definitions/header_steps.rb:2:in `/^I should see "([^"]*)"$/'
features/acceptance/header_information.feature:9:in `Then I should see merchant of "Namics AG"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment