Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Commit

Permalink
add method #exists? with alias #exist? to FireWatir::Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
jarmo committed Feb 27, 2011
1 parent 68eb00b commit 533037d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions firewatir/lib/firewatir/firefox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ def goto(url)
wait()
end

# Returns true if Firefox window is opened.
def exists?
js_eval("getWindows().length").to_i == 1 || ((window = find_window(:url, @window_url)) && window > 0)
end

alias_method :exist?, :exists?

# Loads the previous page (if there is any) in the browser. Waits for the page to get loaded.
def back()
js_eval "if(#{browser_var}.canGoBack) #{browser_var}.goBack()"
Expand Down

0 comments on commit 533037d

Please sign in to comment.