class RoboTest::MultiLocator

Attributes

how[RW]
options[RW]
what[RW]

Public Class Methods

new( how, what, options = { "hidden" => false, "ajax_load" => false } ) click to toggle source
# File lib/robotest/multilocator.rb, line 8
def initialize(
    how,
    what,
    options = {
      "hidden" => false,
      "ajax_load" => false
    }
  )
  @how = how
  @what = what
  @options = options
end

Public Instance Methods

attribute(name, driver = $focus_driver) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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() click to toggle source
# File lib/robotest/multilocator.rb, line 63
def to_s
  return "How ===> #{@how}\nWhat ===> #{@what}\nOptions ===> #{@options}"
end