Class: RoboTest::MultiLocator
- Inherits:
-
Object
- Object
- RoboTest::MultiLocator
- Defined in:
- lib/robotest/multilocator.rb
Instance Attribute Summary collapse
-
#how ⇒ Object
Returns the value of attribute how.
-
#options(driver = $focus_driver) ⇒ Object
Returns the value of attribute options.
-
#what ⇒ Object
Returns the value of attribute what.
Instance Method Summary collapse
- #attribute(name, driver = $focus_driver) ⇒ Object
- #count(driver = $focus_driver) ⇒ Object
- #displayed?(driver = $focus_driver) ⇒ Boolean
- #enabled?(driver = $focus_driver) ⇒ Boolean
- #get_elements(driver = $focus_driver) ⇒ Object
-
#initialize(how, what, options = { "hidden" => false, "ajax_load" => false }) ⇒ MultiLocator
constructor
A new instance of MultiLocator.
- #is_not_present_with_wait?(timeout = $conf["implicit_wait"], driver = $focus_driver) ⇒ Boolean
- #is_present?(driver = $focus_driver) ⇒ Boolean
- #is_present_with_wait?(timeout = $conf["implicit_wait"], driver = $focus_driver) ⇒ Boolean
- #text(driver = $focus_driver) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(how, what, options = { "hidden" => false, "ajax_load" => false }) ⇒ MultiLocator
Returns a new instance of MultiLocator.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/robotest/multilocator.rb', line 8 def initialize( how, what, = { "hidden" => false, "ajax_load" => false } ) @how = how @what = what @options = end |
Instance Attribute Details
#how ⇒ Object
Returns the value of attribute how.
4 5 6 |
# File 'lib/robotest/multilocator.rb', line 4 def how @how end |
#options(driver = $focus_driver) ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/robotest/multilocator.rb', line 6 def @options end |
#what ⇒ Object
Returns the value of attribute what.
5 6 7 |
# File 'lib/robotest/multilocator.rb', line 5 def what @what end |
Instance Method Details
#attribute(name, driver = $focus_driver) ⇒ Object
35 36 37 38 |
# File 'lib/robotest/multilocator.rb', line 35 def attribute(name, driver = $focus_driver) element_list = driver.find_elements(self) return element_list.map{ |n| n.attribute(name) } end |
#count(driver = $focus_driver) ⇒ Object
30 31 32 33 |
# File 'lib/robotest/multilocator.rb', line 30 def count(driver = $focus_driver) element_list = driver.find_elements(self) return element_list.count end |
#displayed?(driver = $focus_driver) ⇒ Boolean
67 68 69 70 |
# File 'lib/robotest/multilocator.rb', line 67 def displayed?(driver = $focus_driver) element_list = driver.find_elements(self) return element_list.map{ |n| n.displayed? } end |
#enabled?(driver = $focus_driver) ⇒ Boolean
72 73 74 75 |
# File 'lib/robotest/multilocator.rb', line 72 def enabled?(driver = $focus_driver) element_list = driver.find_elements(self) return element_list.map{ |n| n.enabled? } end |
#get_elements(driver = $focus_driver) ⇒ Object
77 78 79 |
# File 'lib/robotest/multilocator.rb', line 77 def get_elements(driver = $focus_driver) driver.find_elements(self) end |
#is_not_present_with_wait?(timeout = $conf["implicit_wait"], driver = $focus_driver) ⇒ Boolean
58 59 60 61 |
# File 'lib/robotest/multilocator.rb', line 58 def is_not_present_with_wait?(timeout=$conf["implicit_wait"],driver=$focus_driver) Wait.wait_for_element_hide(self,timeout,driver) return is_present?(driver).map{ |q| !q } end |
#is_present?(driver = $focus_driver) ⇒ Boolean
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/robotest/multilocator.rb', line 40 def is_present?(driver=$focus_driver) driver.driver.manage.timeouts.implicit_wait = 0 begin element_list = driver.driver.find_elements(self.how,self.what) return element_list.map{ |n| n.displayed? } rescue Exception => e driver.driver.manage.timeouts.implicit_wait = $conf["implicit_wait"] return false ensure driver.driver.manage.timeouts.implicit_wait = $conf["implicit_wait"] end end |
#is_present_with_wait?(timeout = $conf["implicit_wait"], driver = $focus_driver) ⇒ Boolean
53 54 55 56 |
# File 'lib/robotest/multilocator.rb', line 53 def is_present_with_wait?(timeout=$conf["implicit_wait"],driver=$focus_driver) Wait.wait_for_element(self,timeout,driver) is_present?(driver) end |
#text(driver = $focus_driver) ⇒ Object
25 26 27 28 |
# File 'lib/robotest/multilocator.rb', line 25 def text(driver = $focus_driver) element_list = driver.find_elements(self) return element_list.map{ |n| n.text } end |
#to_s ⇒ Object
63 64 65 |
# File 'lib/robotest/multilocator.rb', line 63 def to_s return "How ===> #{@how}\nWhat ===> #{@what}\nOptions ===> #{@options}" end |