Question

I am trying to use jruby + page-object gem + Cucumber for a proof of concept. I used the following statement.

app_url = 'https:\\google.com'
page_url(app_url)

I get a

NoMethodError: undefined method `page_url' for #

However,

navigate_to(app_url)

works fine. page_url works fine in Ruby.

Is this the way this works in jRuby? Though navigate_to works, is this any different? Thank you for your help!

Was it helpful?

Solution

page_url is a class method provided by including the PageObject module. It sets the url for the page so you can use the visit_page factory in your test:

object MyPage
  include PageObject
  page_url "http://example.com/"
end

In a test somewhere:

visit_page MyPage do |page|
  page.some_object_element.do_something
end

navigate_to is browser functionality exposed directly in your test via some World magic.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top