Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 12 additions & 56 deletions lib/page-object/platforms/watir/page_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@ def initialize(browser)
@browser = browser
end

def method_missing(method, *args, &block)
if browser.respond_to?(method)
browser.send(method, *args, &block)
else
super
end
end

def respond_to_missing?(method, include_all = false)
browser.respond_to?(method) || super
end

#
# platform method to navigate to a provided url
# See PageObject#navigate_to
Expand All @@ -38,30 +50,6 @@ def current_url
@browser.url
end

#
# platform method to retrieve the text from the current page
# See PageObject#text
#
def text
@browser.text
end

#
# platform method to retrieve the html for the current page
# See PageObject#html
#
def html
@browser.html
end

#
# platform method to retrieve the title for the current page
# See PageObject#title
#
def title
@browser.title
end

#
# platform method to wait for a block to return true
# See PageObject#wait_until
Expand Down Expand Up @@ -115,14 +103,6 @@ def prompt(answer, frame=nil, &block)
result
end

#
# platform method to execute javascript on the browser
# See PageObject#execute_script
#
def execute_script(script, *args)
@browser.execute_script(script, *args)
end

#
# platform method to handle attaching to a running window
# See PageObject#attach_to_window
Expand Down Expand Up @@ -159,30 +139,6 @@ def in_iframe(identifier, frame=nil, &block)
block.call(frame)
end

#
# platform method to refresh the page
# See PageObject#refresh
#
def refresh
@browser.refresh
end

#
# platform method to go back to the previous page
# See PageObject#back
#
def back
@browser.back
end

#
# platform method to go forward to the next page
# See PageObject#forward
#
def forward
@browser.forward
end

#
# platform method to clear the cookies from the browser
# See PageObject#clear_cookies
Expand Down