0

I'm trying to return the current page object URL but I'm not sure how to do this.

My code looks like this:

class APage
include PageObject

page_url '/page_url.com'

def get_page_url
    return @page_url
end

But this doesn't work, as the @page_url does not exist. How can I do this?

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Tiago
  • 673
  • 1
  • 8
  • 24

2 Answers2

1

A method was added for this in version 1.0 of the page-object gem (see Issue 217).

The method is called page_url_value. It would be used like:

page = APage.new(browser)
page.page_url_value
#=> "/page_url.com"
Justin Ko
  • 46,526
  • 5
  • 91
  • 101
0

Very simple. @page_url = 'page_url.com'

hunterboerner
  • 1,264
  • 1
  • 11
  • 25
  • Yes, I know I can create a variable with the same data, but what I meant was to get the value of the page_url attribute from the page object. Is there a way to do this? :) – Tiago Mar 25 '14 at 10:14