Class: LessForm::Form
- Inherits:
-
Object
- Object
- LessForm::Form
- Defined in:
- lib/less-form/form.rb
Instance Attribute Summary collapse
-
#wd ⇒ Object
readonly
Returns the value of attribute wd.
Instance Method Summary collapse
- #button(how, what) ⇒ Object
- #checkbox(how, what) ⇒ Object
-
#initialize(wd) ⇒ Form
constructor
A new instance of Form.
- #locate(how, what) ⇒ Object
- #radio(how, what) ⇒ Object
- #select(how, what) ⇒ Object
- #table(how, what) ⇒ Object
- #text_area(how, what) ⇒ Object
- #text_field(how, what) ⇒ Object
- #valid_wd?(wd) ⇒ Boolean
Constructor Details
#initialize(wd) ⇒ Form
Returns a new instance of Form.
5 6 7 |
# File 'lib/less-form/form.rb', line 5 def initialize wd @wd ||= wd if valid_wd?(wd) end |
Instance Attribute Details
#wd ⇒ Object (readonly)
Returns the value of attribute wd.
3 4 5 |
# File 'lib/less-form/form.rb', line 3 def wd @wd end |
Instance Method Details
#button(how, what) ⇒ Object
38 39 40 |
# File 'lib/less-form/form.rb', line 38 def how, what Button.new locate(how, what) end |
#checkbox(how, what) ⇒ Object
30 31 32 |
# File 'lib/less-form/form.rb', line 30 def checkbox how, what Checkbox.new locate(how, what) end |
#locate(how, what) ⇒ Object
42 43 44 |
# File 'lib/less-form/form.rb', line 42 def locate how, what @wd.find_element(how ,what) end |
#radio(how, what) ⇒ Object
22 23 24 |
# File 'lib/less-form/form.rb', line 22 def radio how, what Radio.new locate(how, what) end |
#select(how, what) ⇒ Object
34 35 36 |
# File 'lib/less-form/form.rb', line 34 def select how, what Select.new locate(how, what) end |
#table(how, what) ⇒ Object
26 27 28 |
# File 'lib/less-form/form.rb', line 26 def table how, what Table.new locate(how, what) end |
#text_area(how, what) ⇒ Object
18 19 20 |
# File 'lib/less-form/form.rb', line 18 def text_area(how, what) TextArea.new(locate(how, what)) end |
#text_field(how, what) ⇒ Object
14 15 16 |
# File 'lib/less-form/form.rb', line 14 def text_field(how, what) TextField.new(locate(how, what)) end |
#valid_wd?(wd) ⇒ Boolean
9 10 11 12 |
# File 'lib/less-form/form.rb', line 9 def valid_wd?(wd) raise InvalidDriverError unless wd.is_a?(Selenium::WebDriver::Driver) true end |