Module: OperaWatir::Compat::Window
- Includes:
- Deprecated
- Defined in:
- lib/operawatir/compat/window.rb
Instance Method Summary collapse
-
#contains_text(str) ⇒ Boolean
Checks whether the body has the given text in it.
-
#elements_by_xpath(value) ⇒ OperaWatir::Collection
(also: #element_by_xpath)
Find elements that match the given XPath.
-
#frame(selector, argument) ⇒ Object
TODO This is a relic from the old OperaWatir implementation, tests should be updated.
-
#get_hash ⇒ Object
Opera specific.
- #show_frames ⇒ Object
- #switch_to_default ⇒ Object
Instance Method Details
#contains_text(str) ⇒ Boolean
Checks whether the body has the given text in it.
14 15 16 |
# File 'lib/operawatir/compat/window.rb', line 14 def contains_text(str) text.index(str) end |
#elements_by_xpath(value) ⇒ OperaWatir::Collection Also known as: element_by_xpath
Find elements that match the given XPath.
27 28 29 |
# File 'lib/operawatir/compat/window.rb', line 27 def elements_by_xpath(value) find_by_xpath(value) end |
#frame(selector, argument) ⇒ Object
TODO This is a relic from the old OperaWatir implementation, tests should be updated.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/operawatir/compat/window.rb', line 50 def frame(selector, argument) case selector when :name driver.switch_to.frame(argument) when :index driver.switch_to.frame(argument.to_i - 1) # index starts from 1 in Watir else raise OperaWatir::Exceptions::NotImplementedException, "We do not support the `#{selector}' selector yet" end end |
#get_hash ⇒ Object
Opera specific
38 39 40 |
# File 'lib/operawatir/compat/window.rb', line 38 def get_hash visual_hash end |
#show_frames ⇒ Object
68 69 70 71 72 73 |
# File 'lib/operawatir/compat/window.rb', line 68 def show_frames frames = driver.list_frames text = "There are #{frames.length.to_s} frames\n" frames.each_with_index { |frame, i| text << "frame index: #{(i.to_i + 1).to_s} name: #{frame.to_s}\n" } text end |
#switch_to_default ⇒ Object
63 64 65 |
# File 'lib/operawatir/compat/window.rb', line 63 def switch_to_default driver.switch_to.default_content end |