Skip to content

Commit

Permalink
implemented highlevel click() method for session, which is clicks on
Browse files Browse the repository at this point in the history
everything.. links and buttons. you can still continue to use
click_link|click_button as well.
  • Loading branch information
alecnmk committed Jan 13, 2010
1 parent 1866271 commit 162956b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/webrat/webdriver/webdriver_session.rb
Expand Up @@ -58,6 +58,14 @@ def current_url
webdriver.current_url
end

def click(locator = nil, options = {})
begin
click_link(locator, options)
rescue
click_button(locator, options)
end
end #click

def click_button(locator = nil, options = {})
if locator.nil?
webdriver.find_element(:xpath, "//input|button[@type='submit']").click
Expand Down Expand Up @@ -142,6 +150,7 @@ def save_and_open_screengrab

filename = "#{saved_page_dir}/webrat-#{Time.now.to_i}.png"
$browser.save_screenshot(filename)

open_in_browser(filename)
end

Expand Down

0 comments on commit 162956b

Please sign in to comment.