Class: Watir::Container::HtmlElement
Direct Known Subclasses
Constant Summary collapse
- OPERATIONS =
{ :id => "by_id", :index => "by_index", :class => "by_class", :name => "by_name", :text => { "Link" => "on_link", "Label" => "by_text" }, :url => "on_link", :value => "by_input_value", :caption => "by_input_value", :src => "by_src", :xpath => "by_xpath", }
Instance Attribute Summary collapse
-
#how ⇒ Object
readonly
Returns the value of attribute how.
-
#what ⇒ Object
readonly
Returns the value of attribute what.
Instance Method Summary collapse
- #exists? ⇒ Boolean (also: #exist?)
- #name ⇒ Object
- #operate(&block) ⇒ Object
-
#speak ⇒ Object
overridden in derivitives.
-
#tag ⇒ Object
overridden in derivitives.
Instance Attribute Details
#how ⇒ Object (readonly)
Returns the value of attribute how.
101 102 103 |
# File 'lib/safariwatir.rb', line 101 def how @how end |
#what ⇒ Object (readonly)
Returns the value of attribute what.
101 102 103 |
# File 'lib/safariwatir.rb', line 101 def what @what end |
Instance Method Details
#exists? ⇒ Boolean Also known as: exist?
113 114 115 |
# File 'lib/safariwatir.rb', line 113 def exists? @scripter.element_exists?(self) end |
#name ⇒ Object
118 119 120 |
# File 'lib/safariwatir.rb', line 118 def name self.class.name.split("::").last end |
#operate(&block) ⇒ Object
122 123 124 125 126 127 128 129 130 131 |
# File 'lib/safariwatir.rb', line 122 def operate(&block) scripter_suffix = OPERATIONS[how] if scripter_suffix.kind_of? Hash scripter_suffix = scripter_suffix[name] end if scripter_suffix.nil? raise "SafariWatir does not currently support finding by #{how}" end @scripter.send("operate_#{scripter_suffix}", self, &block) end |
#speak ⇒ Object
overridden in derivitives
109 110 111 |
# File 'lib/safariwatir.rb', line 109 def speak @scripter.speak("#{name}'s don't know how to speak.") end |
#tag ⇒ Object
overridden in derivitives
104 105 106 |
# File 'lib/safariwatir.rb', line 104 def tag raise RuntimeError, "tag not provided for #{name}" end |