Module: Watir::Container
- Includes:
- Exception
- Included in:
- Element, IE, ModalDialog
- Defined in:
- lib/watir-classic/container.rb,
lib/watir-classic/supported_elements.rb
Overview
This module contains the factory methods that are used to access most html objects
For example, to access a button on a web page that has the following html
<input type=button name='b1' value='Click Me' onClick='javascript:doSomething()'>
the following watir code could be used to click the button
browser.(:name, 'b1').click
or to find the name attribute
browser.(:value, 'Click Me').name
there are many methods available to the Button object – Is includable for classes that have @container, document and __ole_inner_elements
Instance Attribute Summary collapse
-
#activeObjectHighLightColor ⇒ Object
The color we want to use for the active object.
-
#page_container ⇒ Object
(also: #browser)
The PageContainer object containing this element.
-
#type_keys ⇒ Object
Returns the value of attribute type_keys.
-
#typingspeed ⇒ Object
This is used to change the typing speed when entering text on a page.
Class Method Summary collapse
Instance Method Summary collapse
-
#__ole_inner_elements ⇒ Object
Searching for Page Elements Not for external consumption.
- #alert ⇒ Object
-
#locator_for(locator_class, specifiers, klass) ⇒ Object
Locator Methods.
- #modal_dialog ⇒ Object
-
#set_container(container) ⇒ Object
:nodoc:.
-
#wait(no_sleep = false) ⇒ Object
Wait until Browser has finished loading the page.
Methods included from Exception
Instance Attribute Details
#activeObjectHighLightColor ⇒ Object
The color we want to use for the active object. This can be any valid web-friendly color.
30 31 32 |
# File 'lib/watir-classic/container.rb', line 30 def activeObjectHighLightColor @activeObjectHighLightColor end |
#page_container ⇒ Object Also known as: browser
The PageContainer object containing this element
32 33 34 |
# File 'lib/watir-classic/container.rb', line 32 def page_container @page_container end |
#type_keys ⇒ Object
Returns the value of attribute type_keys.
28 29 30 |
# File 'lib/watir-classic/container.rb', line 28 def type_keys @type_keys end |
#typingspeed ⇒ Object
This is used to change the typing speed when entering text on a page.
27 28 29 |
# File 'lib/watir-classic/container.rb', line 27 def typingspeed @typingspeed end |
Class Method Details
.support_element(method_name, args = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/watir-classic/supported_elements.rb', line 5 def support_element method_name, args={} klass = args[:class] || method_name.to_s.capitalize super_class = args[:super_class] || "Element" unless Watir.const_defined? klass Watir.class_eval %Q[class #{klass} < #{super_class}; end] end unless Watir.const_defined? "#{klass}Collection" Watir.class_eval %Q[class #{klass}Collection < #{args[:super_collection] || super_class}Collection; end] end tag_name = args[:tag_name] || method_name Watir::Container.module_eval %Q[ def #{method_name}(how={}, what=nil) #{klass}.new(self, format_specifiers(#{tag_name.inspect}, how, what)) end def #{args.delete(:plural) || method_name.to_s + "s"}(how={}, what=nil) specifiers = format_specifiers(#{tag_name.inspect}, how, what) #{klass}Collection.new(self, specifiers) end ] end |
Instance Method Details
#__ole_inner_elements ⇒ Object
Searching for Page Elements Not for external consumption
++
68 69 70 |
# File 'lib/watir-classic/container.rb', line 68 def __ole_inner_elements return document.body.all end |
#alert ⇒ Object
60 61 62 |
# File 'lib/watir-classic/container.rb', line 60 def alert Alert.new(self) end |
#locator_for(locator_class, specifiers, klass) ⇒ Object
Locator Methods
Not for external use, but cannot set to private due to usages in Element classes.
77 78 79 |
# File 'lib/watir-classic/container.rb', line 77 def locator_for(locator_class, specifiers, klass) locator_class.new self, specifiers, klass end |
#modal_dialog ⇒ Object
56 57 58 |
# File 'lib/watir-classic/container.rb', line 56 def modal_dialog ModalDialog.new(self) end |
#set_container(container) ⇒ Object
:nodoc:
49 50 51 52 |
# File 'lib/watir-classic/container.rb', line 49 def set_container container #:nodoc: @container = container @page_container = container.page_container end |
#wait(no_sleep = false) ⇒ Object
Wait until Browser has finished loading the page. – called explicitly by most click and set methods
45 46 47 |
# File 'lib/watir-classic/container.rb', line 45 def wait(no_sleep=false) @container.wait(no_sleep) end |