class RWebSpec::WebBrowser

Wrapping WATIR IE and FireWatir Firefox

Attributes

context[RW]

Public Class Methods

attach_browser(how, what, options={}) click to toggle source

Attach to existing browser

Usage:

WebBrowser.attach_browser(:title, "iTest2")
WebBrowser.attach_browser(:url, "http://www.itest2.com")
WebBrowser.attach_browser(:url, "http://www.itest2.com", {:browser => "Firefox", :base_url => "http://www.itest2.com"})
WebBrowser.attach_browser(:title, /agileway\.com\.au\/attachment/)  # regular expression
# File lib/rwebspec-watir/web_browser.rb, line 499
def self.attach_browser(how, what, options={})
  default_options = {:browser => "IE"}
  options = default_options.merge(options)
  site_context = Context.new(options[:base_url]) if options[:base_url]
  return WebBrowser.new_from_existing(Watir::IE.attach(how, what), site_context)
end
close_all_browsers() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 341
def self.close_all_browsers
  puts "[WARN] not supported yet in RWebSpec-WebDriver"
end
is_windows?() click to toggle source

is it running in MS Windows platforms?

# File lib/rwebspec-watir/web_browser.rb, line 582
def self.is_windows?
  RUBY_PLATFORM.downcase.include?("mswin") or RUBY_PLATFORM.downcase.include?("mingw")
end
new(base_url = nil, existing_browser = nil, options = {}) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 16
def initialize(base_url = nil, existing_browser = nil, options = {})
  default_options = {:speed => "zippy",
    :visible => true,
    :highlight_colour => 'yellow',
    :close_others => true
  }
  options = default_options.merge options
  @context = Context.new base_url if base_url

  initialize_ie_browser(existing_browser, options)
end
new_from_existing(underlying_browser, web_context = nil) click to toggle source

for popup windows

# File lib/rwebspec-watir/web_browser.rb, line 69
def self.new_from_existing(underlying_browser, web_context = nil)
  return WebBrowser.new(web_context ? web_context.base_url : nil, underlying_browser, {:close_others => false})
end
reuse(base_url, options) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 53
def self.reuse(base_url, options)
  if self.is_windows? && ($TESTWISE_BROWSER != "Firefox" && $TESTWISE_BROWSER != "Firefox")
                            require 'watir-classic' 
                            # try to avoid 

                            #  lib/ruby/1.8/dl/win32.rb:11:in `sym': unknown type specifier 'v'

    Watir::IE.each do |browser_window|
      return WebBrowser.new(base_url, browser_window, options)
    end
    #puts "no browser instance found"

    WebBrowser.new(base_url, nil, options)
  else
    WebBrowser.new(base_url, nil, options)
  end
end

Public Instance Methods

area(*args) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 88
def area(*args)
  @browser.send("area", *args)
end
as()
Alias for: links
back() click to toggle source

TODO can't browse back if on invalid page

# File lib/rwebspec-webdriver/web_browser.rb, line 399
def back
  @browser.navigate.back
end
Also aliased as: go_back, go_back
base_url=(new_base_url) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 206
def base_url=(new_base_url)
  if @context
    @conext.base_url = new_base_url
    return
  end
  @context = Context.new base_url
end
begin_at(relative_url) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 238
def begin_at(relative_url)
  @browser.goto full_url(relative_url)
end
browser_opened?() click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 242
def browser_opened?
  begin
    @browser != nil
  rescue => e
    return false
  end
end
buttons() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 289
def buttons
        button_array = @browser.find_elements(:tag_name, "button") + @browser.find_elements(:xpath, "//input[@type='submit']") + @browser.find_elements(:xpath, "//input[@type='button']")
        return button_array
end
check_checkbox(checkBoxName, values=nil) click to toggle source

Check a checkbox Usage:

check_checkbox("agree")
check_checkbox("agree", "true")
# File lib/rwebspec-watir/web_browser.rb, line 396
def check_checkbox(checkBoxName, values=nil)
  if values
    values.class == Array ? arys = values : arys = [values]
    arys.each {|cbx_value|
                                    if Watir::VERSION =~ /^1/ then             
            checkbox(:name, checkBoxName, cbx_value).set                                         
                                    else
            checkbox(:name => checkBoxName, :value => cbx_value).set
                                    end
    }
  else
    checkbox(:name, checkBoxName).set
  end
end
checkboxes() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 277
def checkboxes
        @browser.find_elements(:xpath, "//input[@type='checkbox']")
end
clear_radio_button(radio_group, radio_option)
Alias for: clear_radio_option
clear_radio_option(radio_group, radio_option) click to toggle source

Clear a radio button

Usage:
  click_radio_option("country", "Australia")
# File lib/rwebspec-watir/web_browser.rb, line 446
def clear_radio_option(radio_group, radio_option)
                    if Watir::VERSION =~ /^2/ then
    radio(:name => radio_group, :value => radio_option).clear                               
                    else
    radio(:name, radio_group, radio_option).clear
                    end
end
Also aliased as: clear_radio_button, clear_radio_button
click_button(caption, opts={})
click_button_with_caption(caption, opts={}) click to toggle source

Click a button with caption Usage:

click_button_with_caption("Confirm payment")
# File lib/rwebspec-watir/web_browser.rb, line 351
def click_button_with_caption(caption, opts={})
    if opts && opts[:index]
      wait_before_and_after { button(:caption => caption, :index => opts[:index]).click }
    else
      wait_before_and_after { button(:caption, caption).click }
    end
end
Also aliased as: click_button, click_button_with_text, click_button, click_button_with_text
click_button_with_id(id, opts = {}) click to toggle source

Click a button with give HTML id Usage:

click_button_with_id("btn_sumbit")
# File lib/rwebspec-watir/web_browser.rb, line 329
def click_button_with_id(id, opts = {})
  if opts && opts[:index]
      wait_before_and_after { button(:id => id,  :index => opts[:index]).click  }
  else
      wait_before_and_after { button(:id, id).click }
  end
end
click_button_with_image(image_filename)
click_button_with_image_src_contains(image_filename) click to toggle source

Click image buttion with image source name

For an image submit button <input name=“submit” type=“image” src=“/images/search_button.gif”>

click_button_with_image("search_button.gif")
# File lib/rwebspec-webdriver/web_browser.rb, line 542
def click_button_with_image_src_contains(image_filename)
  all_buttons = button_elements
  found = nil
  all_buttons.select do |x|
    if x["src"] =~ /#{Regexp.escape(image_filename)}/
      found = x
      break
    end
  end

  raise "not image button with src: #{image_filename} found" if found.nil?
  found.click
end
Also aliased as: click_button_with_image
click_button_with_name(name, opts={}) click to toggle source

Click a button with give name Usage:

click_button_with_name("confirm")
# File lib/rwebspec-watir/web_browser.rb, line 340
def click_button_with_name(name, opts={})
  if opts && opts[:index]
    wait_before_and_after { button(:name => name, :index => opts[:index]).click }
  else
    wait_before_and_after { button(:name, name).click }
  end
end
click_button_with_text(caption, opts={})
click_button_with_value(value, opts={}) click to toggle source

Click a button with value Usage:

click_button_with_value("Confirm payment")
# File lib/rwebspec-watir/web_browser.rb, line 364
def click_button_with_value(value, opts={})
    if opts && opts[:index]
      wait_before_and_after { button(:value => value, :index => opts[:index]).click }
    else
      wait_before_and_after { button(:value, value).click }
    end
end
click_radio_button(radio_group, radio_option)
Alias for: click_radio_option
click_radio_option(radio_group, radio_option) click to toggle source

Click a radio button

Usage:
  click_radio_option("country", "Australia")
# File lib/rwebspec-watir/web_browser.rb, line 434
def click_radio_option(radio_group, radio_option)
                    if Watir::VERSION =~ /^1/ then
    radio(:name, radio_group, radio_option).set                              
                    else
    radio(:name => radio_group, :value => radio_option).set
                    end
end
Also aliased as: click_radio_button, click_radio_button
close()
Alias for: close_browser
close_all_browsers(browser_type = :ie) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 226
def close_all_browsers(browser_type = :ie)      
                    @browser.windows.each(&:close)
end
close_browser() click to toggle source

Close the browser window. Useful for automated test suites to reduce test interaction.

# File lib/rwebspec-watir/web_browser.rb, line 220
def close_browser
  @browser.close
  sleep 2
end
Also aliased as: close, close
contains_text(text) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 164
def contains_text(text)
  @browser.contains_text(text);
end
current_url() click to toggle source

current url

# File lib/rwebspec-webdriver/web_browser.rb, line 299
def current_url
  @browser.current_url
end
Also aliased as: url
divs() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 294
def divs
        @browser.find_elements(:tag_name, "divs")
end
driver() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 312
def driver
  @browser
end
dump_response(stream = nil) click to toggle source

For deubgging


# File lib/rwebspec-watir/web_browser.rb, line 527
def dump_response(stream = nil)
  stream.nil? ?  puts(page_source) : stream.puts(page_source)
end
element(how, what) click to toggle source

This is the main method for accessing a generic element with a given attibute

*  how   - symbol - how we access the element. Supports all values except :index and :xpath
*  what  - string, integer or regular expression - what we are looking for,

Valid values for 'how' are listed in the Watir Wiki - wiki.openqa.org/display/WTR/Methods+supported+by+Element

returns an Watir::Element object

Typical Usage

element(:class, /foo/)      # access the first element with class 'foo'. We can use a string in place of the regular expression
element(:id, "11")          # access the first element that matches an id
# File lib/rwebspec-watir/web_browser.rb, line 108
def element(how, what)
  return @browser.element(how, what)
end
element_by_id(elem_id) click to toggle source

Deprecated: using Watir style directly instead

# File lib/rwebspec-watir/web_browser.rb, line 456
def element_by_id(elem_id)
  if is_firefox?
    # elem = @browser.document.getElementById(elem_id)

    # elem = div(:id, elem_id) || label(:id, elem_id)  || button(:id, elem_id) || 

                            # span(:id, elem_id) || hidden(:id, elem_id) || link(:id, elem_id) || radio(:id, elem_id)

                            elem = browser.element_by_xpath("//*[@id='#{elem_id}']")
  else
    elem = @browser.document.getElementById(elem_id)
  end
end
element_source(elementId) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 472
def element_source(elementId)
  elem = element_by_id(elementId)
  assert_not_nil(elem, "HTML element: #{elementId} not exists")
  elem.innerHTML
end
element_value(elementId) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 467
def element_value(elementId)
  elem = element_by_id(elementId)
  elem ? elem.invoke('innerText') : nil
end
elements(how, what) click to toggle source

this is the main method for accessing generic html elements by an attribute

Returns a HTMLElements object

Typical usage:

elements(:class, 'test').each { |l| puts l.to_s }  # iterate through all elements of a given attribute
elements(:alt, 'foo')[1].to_s                       # get the first element of a given attribute
elements(:id, 'foo').length                        # show how many elements are foung in the collection
# File lib/rwebspec-watir/web_browser.rb, line 122
def elements(how, what)
  return @browser.elements(how, what)
end
enter_text(name, text)
enter_text_into_field_with_name(name, text) click to toggle source

text fields

# File lib/rwebspec-watir/web_browser.rb, line 294
def enter_text_into_field_with_name(name, text)
  if is_firefox?
    wait_before_and_after { text_field(:name, name).value = text }
    sleep 0.3
  else
    wait_before_and_after { text_field(:name, name).set(text) }
  end
end
Also aliased as: set_form_element, enter_text, set_form_element, enter_text
expect_page(page_clazz, argument = nil) click to toggle source

Verify the next page following an operation.

Typical usage:

browser.expect_page HomePage
# File lib/rwebspec-watir/web_browser.rb, line 573
def expect_page(page_clazz, argument = nil)
  if argument
    page_clazz.new(self, argument)
  else
    page_clazz.new(self)
  end
end
find_checkboxes_by_name(checkBoxName) click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 596
def find_checkboxes_by_name(checkBoxName)
  elements = find_elements(:name, checkBoxName)
  elements.reject! {|x| x.tag_name != "input" ||  x["type"] != "checkbox"} 
  raise "No checkbox with name #{checkBoxName} found" if elements.empty?
  return elements
end
find_element(* args) click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 128
def find_element(* args)
  @browser.send("find_element", *args)
end
find_elements(* args) click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 132
def find_elements(* args)
  @browser.send("find_elements", *args)
end
firefox() click to toggle source

return underlying firefox browser object, raise error if not running using Firefox

# File lib/rwebspec-webdriver/web_browser.rb, line 721
def firefox
  is_firefox?  ? @browser : nil;
end
forward() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 393
def forward
  @browser.navigate().forward
end
Also aliased as: go_forward, go_forward
full_url(relative_url) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 230
def full_url(relative_url)
  if @context && @context.base_url
    @context.base_url + relative_url
  else
    relative_url
  end
end
go_back()
Alias for: back
go_forward()
Alias for: forward
goto_page(page) click to toggle source

Go to a page

Usage:
  open_browser(:base_url => "http://www.itest2.com")
  ....
  goto_page("/purchase")  # full url => http://www.itest.com/purchase
# File lib/rwebspec-watir/web_browser.rb, line 282
def goto_page(page)
                    # puts "DEBUG calling goto page => #{page}" 

  @browser.goto full_url(page);
end
goto_url(url) click to toggle source

Go to a URL directly

goto_url("http://www.itest2.com/downloads")
# File lib/rwebspec-watir/web_browser.rb, line 289
def goto_url(url)
  @browser.goto url
end
html()
Alias for: page_source
html_body()
Alias for: page_source
htmlunit() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 725
def htmlunit
  raise "can't call this as it is configured to use Celerity" unless RUBY_PLATFORM =~ /java/
  @browser
end
ie() click to toggle source

return underlying browser

# File lib/rwebspec-watir/web_browser.rb, line 554
def ie
  @browser
end
initialize_chrome_browser(existing_browser, base_url, options) click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 62
def initialize_chrome_browser(existing_browser, base_url, options)
  if existing_browser then
    @browser = existing_browser
    return
  end

  @browser = Selenium::WebDriver.for :chrome
  @browser.navigate.to base_url
end
initialize_firefox_browser(existing_browser, base_url, options) click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 52
def initialize_firefox_browser(existing_browser, base_url, options)
  if existing_browser then
    @browser = existing_browser
    return
  end

  @browser = Selenium::WebDriver.for :firefox
  @browser.navigate.to base_url
end
initialize_htmlunit_browser(base_url, options) click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 72
def initialize_htmlunit_browser(base_url, options)
  puts "XXXXX start HtmlUnit..."
  require 'json'
  caps = Selenium::WebDriver::Remote::Capabilities.htmlunit(:javascript_enabled => false)        
  client = Selenium::WebDriver::Remote::Http::Default.new
  # client.proxy = Selenium::WebDriver::Proxy.new(:http => "web-proxy.qdot.qld.gov.au:3128")

  
  @browser = Selenium::WebDriver.for(:remote, :http_client => client , :desired_capabilities => caps)         
  if options[:go] 
    @browser.navigate.to(base_url) 
  end
end
initialize_ie_browser(existing_browser, options) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 29
def initialize_ie_browser(existing_browser, options)
  @browser = existing_browser ||  Watir::IE.new
  if ($TESTWISE_EMULATE_TYPING && $TESTWISE_TYPING_SPEED) then
    @browser.set_slow_speed if $TESTWISE_TYPING_SPEED == "slow"
    @browser.set_fast_speed if $TESTWISE_TYPING_SPEED == 'fast'
  else
    @browser.speed = :zippy
  end
                    
                    return if existing_browser

                    # Watir-classic 3.4 drop the support                 

  # @browser.activeObjectHighLightColor = options[:highlight_colour]

  @browser.visible = options[:visible] unless $HIDE_IE
  #NOTE: close_others fails

                    begin
          if options[:close_others] then
                                    @browser.windows.reject(&:current?).each(&:close)
          end
                    rescue => e1
                            puts "Failed to close others"
                    end
end
is_firefox?() click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 214
def is_firefox?
  return false
end
is_ie?() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 320
def is_ie?
  @browser.browser.to_s == "ie"
end
javascript_dialog() click to toggle source

Watir 1.9

# File lib/rwebspec-watir/web_browser.rb, line 484
def javascript_dialog
        @browser.javascript_dialog
end
locate_input_element(how, what, types, value=nil) click to toggle source

Returns the specified ole object for input elements on a web page.

This method is used internally by Watir and should not be used externally. It cannot be marked as private because of the way mixins and inheritance work in watir

* how - symbol - the way we look for the object. Supported values are
               - :name
               - :id
               - :index
               - :value etc
* what  - string that we are looking for, ex. the name, or id tag attribute or index of the object we are looking for.
* types - what object types we will look at.
* value - used for objects that have one name, but many values. ex. radio lists and checkboxes
# File lib/rwebspec-watir/web_browser.rb, line 142
def locate_input_element(how, what, types, value=nil)
  @browser.locate_input_element(how, what, types, value)
end
map(how, what=nil) click to toggle source

This is the main method for accessing map tags - msdn.microsoft.com/workshop/author/dhtml/reference/objects/map.asp?frame=true

*  how   - symbol - how we access the map,
*  what  - string, integer or regular expression - what we are looking for,

Valid values for 'how' are listed in the Watir Wiki - wiki.openqa.org/display/WTR/Methods+supported+by+Element

returns a map object

Typical Usage

map(:id, /list/)                 # access the first map that matches list.
map(:index,2)                    # access the second map on the page
map(:title, "A Picture")         # access a map using the tooltip text. See http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/title_1.asp?frame=true
# File lib/rwebspec-watir/web_browser.rb, line 160
def map(how, what=nil)
  @browser.map(how, what)
end
modal_dialog(how=nil, what=nil) click to toggle source
new_popup_window(options, browser = "ie") click to toggle source

Attach a Watir::IE instance to a popup window.

Typical usage

new_popup_window(:url => "http://www.google.com/a.pdf")
# File lib/rwebspec-watir/web_browser.rb, line 510
def new_popup_window(options, browser = "ie")
  if is_firefox?
    raise "not implemented"
  else
    if options[:url]
      Watir::IE.attach(:url, options[:url])
    elsif options[:title]
      Watir::IE.attach(:title, options[:title])
    else
      raise 'Please specify title or url of new pop up window'
    end
  end
end
page_source() click to toggle source

return HTML of current web page

# File lib/rwebspec-watir/web_browser.rb, line 169
def page_source
  @browser.html()
  #@browser.document.body

end
Also aliased as: html_body, html, html_body, html
page_title() click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 182
def page_title
  case @browser.class.to_s
  when "Watir::IE"
    @browser.document.title
  else
    @browser.title
  end
end
radios() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 281
def radios
        @browser.find_elements(:xpath, "//input[@type='radio']")
end
refresh() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 404
def refresh
  @browser.navigate().refresh
end
Also aliased as: refresh_page, refresh_page
refresh_page()
Alias for: refresh
save_page(file_name = nil) click to toggle source

Save current web page source to file

usage:
   save_page("/tmp/01.html")
   save_page()  => # will save to "20090830112200.html"
# File lib/rwebspec-watir/web_browser.rb, line 562
def save_page(file_name = nil)
  file_name ||= Time.now.strftime("%Y%m%d%H%M%S") + ".html"
  puts "about to save page: #{File.expand_path(file_name)}" if $DEBUG
  File.open(file_name, "w").puts page_source
end
select_file_for_upload(file_field, file_path) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 478
def select_file_for_upload(file_field, file_path)
  normalized_file_path = RUBY_PLATFORM.downcase.include?("mingw") ? file_path.gsub("/", "\\") : file_path
  file_field(:name, file_field).set(normalized_file_path)
end
select_lists() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 285
def select_lists
        @browser.find_elements(:tag_name, "select")
end
select_option(selectName, option) click to toggle source

Select a dropdown list by name Usage:

select_option("country", "Australia")
# File lib/rwebspec-watir/web_browser.rb, line 375
def select_option(selectName, option)
  select_list(:name, selectName).select(option)
end
set_form_element(name, text)
Also aliased as: set_hidden_field, set_hidden_field
set_hidden_field(name, text)
Alias for: set_form_element
show_all_objects() click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 126
def show_all_objects
  @browser.show_all_objects
end
start_clicker( button, waitTime= 9, user_input=nil) click to toggle source

A Better Popup Handler using the latest Watir version. Posted by Mark_cain@rl.gov

wiki.openqa.org/display/WTR/FAQ#FAQ-HowdoIattachtoapopupwindow%3F

# File lib/rwebspec-watir/web_browser.rb, line 535
def start_clicker( button, waitTime= 9, user_input=nil)
  # get a handle if one exists

  hwnd = @browser.enabled_popup(waitTime)
  if (hwnd)  # yes there is a popup

    w = WinClicker.new
    if ( user_input )
      w.setTextValueForFileNameField( hwnd, "#{user_input}" )
    end
    # I put this in to see the text being input it is not necessary to work

    sleep 3
    # "OK" or whatever the name on the button is

    w.clickWindowsButton_hwnd( hwnd, "#{button}" )
    #

    # this is just cleanup

    w = nil
  end
end
start_window(url = nil) click to toggle source
# File lib/rwebspec-watir/web_browser.rb, line 488
def start_window(url = nil)
  @browser.start_window(url);
end
submit(buttonName = nil) click to toggle source

submit first submit button

# File lib/rwebspec-watir/web_browser.rb, line 380
def submit(buttonName = nil)
  if (buttonName.nil?) then
    buttons.each { |button|
      next if button.type != 'submit'
      button.click
      return
    }
  else
    click_button_with_name(buttonName)
  end
end
text() click to toggle source

return plain text of current web page

# File lib/rwebspec-watir/web_browser.rb, line 178
def text
  @browser.text
end
text_with_sanitize() click to toggle source

@deprecated

# File lib/rwebspec-webdriver/web_browser.rb, line 248
        def text_with_sanitize                               
                begin
                        require 'sanitize'
page_text_string = Sanitize.clean(html)
                        page_text_string = page_text_string.squeeze(" ") if squeeze_spaces
                                # remove duplicated (spaces)

                        return page_text_string
                rescue => e
                        puts "failed to santize html source => text, #{e}"
                        return @browser.html
                end
        end
uncheck_checkbox(checkBoxName, values = nil) click to toggle source

Check a checkbox Usage:

uncheck_checkbox("agree")
uncheck_checkbox("agree", "false")
# File lib/rwebspec-watir/web_browser.rb, line 415
def uncheck_checkbox(checkBoxName, values = nil)
  if values
    values.class == Array ? arys = values : arys = [values]
    arys.each {|cbx_value|
                                    if Watir::VERSION =~ /^1/ then     
            checkbox(:name, checkBoxName, cbx_value).clear
                                    else
            checkbox(:name => checkBoxName, :value => cbx_value).clear
                                    end
    }
  else
    checkbox(:name, checkBoxName).clear
  end
end
underlying_browser() click to toggle source
# File lib/rwebspec-webdriver/web_browser.rb, line 316
def underlying_browser
  @browser
end
url() click to toggle source

current url

# File lib/rwebspec-watir/web_browser.rb, line 202
def url
  @browser.url
end
wait_before_and_after() { || ... } click to toggle source

A convenience method to wait at both ends of an operation for the browser to catch up.

# File lib/rwebspec-watir/web_browser.rb, line 261
def wait_before_and_after
  wait_for_browser
  yield
  wait_for_browser
end
wait_for_browser() click to toggle source

Some browsers (i.e. IE) need to be waited on before more actions can be performed. Most action methods in Watir::Simple already call this before and after.

# File lib/rwebspec-watir/web_browser.rb, line 253
def wait_for_browser
                      # Watir 3 does not support it any more

    # @browser.waitForIE unless is_firefox?

end