diff --git a/lib/page-object/platforms/watir/page_object.rb b/lib/page-object/platforms/watir/page_object.rb index e69ff959..967b4ecf 100644 --- a/lib/page-object/platforms/watir/page_object.rb +++ b/lib/page-object/platforms/watir/page_object.rb @@ -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 @@ -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 @@ -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 @@ -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