0

Using page_objects gem, Cucumber and Watir-Webdriver. I have a link/button that I want to click on. In IRB I can click on it via the div as such:

b.div(:text, "Verify your membership").click

The HTML:

div class="verification-header button -gray -browse btn-verify" style="top: 0px;">
  Verify your membership
</div>

In my page object I have:

  div(:membership, :text => "Verify your membership")

And I call it as such:

membership

But the link/button isn't clicked. So the question is how to click a link/button that is a div?

Farooq
  • 1,925
  • 3
  • 15
  • 36

1 Answers1

2

Div elements do not usually need to be clicked, which is why the page object accessor creates a membership method to return the div text rather than click it.

To click it, you can directly call the click method:

membership_element.click
Justin Ko
  • 46,526
  • 5
  • 91
  • 101
  • Thanks Justin! I was calling .click on 'membership' but didn't realize I had to use 'membership_element'. – Farooq Dec 03 '14 at 04:16