Module: RoboTest::Wait

Defined in:
lib/robotest/wait.rb

Class Method Summary collapse

Class Method Details

.wait_for_element(locator, timeout = $conf["implicit_wait"], focus_driver = $focus_driver) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/robotest/wait.rb', line 7

def wait_for_element(locator, timeout=$conf["implicit_wait"], focus_driver = $focus_driver)
  index=0
  case locator
    when RoboTest::Locator
      while locator.is_present?(focus_driver) == false
        sleep 1
        if index == timeout
          break
        end
        index+=1
      end

    when RoboTest::MultiLocator
      list = locator.is_present?(focus_driver)
      while list.include?(false)
        sleep 1
        if index == timeout
          break
        end
        index+=1
      end
  end
end

.wait_for_element!(locator, timeout = $conf["implicit_wait"], focus_driver = $focus_driver) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'lib/robotest/wait.rb', line 54

def wait_for_element!(locator, timeout=$conf["implicit_wait"], focus_driver = $focus_driver)
  wait_for_element(locator, timeout, focus_driver)
  case locator
  when RoboTest::Locator
    raise "Element is not found !!!" unless locator.is_present?
  when RoboTest::MultiLocator
    raise "No element is found !!!" unless locator.is_present?.include?(true)
  end
end

.wait_for_element_hide(locator, timeout = $conf["implicit_wait"], focus_driver = $focus_driver) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/robotest/wait.rb', line 31

def wait_for_element_hide(locator, timeout=$conf["implicit_wait"], focus_driver = $focus_driver)
  index=0
  case locator
    when RoboTest::Locator
      while locator.is_present?(focus_driver) == true
        sleep 1
        if index == timeout
          break
        end
        index+=1
      end
    when RoboTest::MultiLocator
      list = locator.is_present?(focus_driver)
      while list.include?(true)
        sleep 1
        if index == timeout
          break
        end
        index+=1
      end
  end
end

.wait_for_element_hide!(locator, timeout = $conf["implicit_wait"], focus_driver = $focus_driver) ⇒ Object



64
65
66
67
68
69
70
71
72
# File 'lib/robotest/wait.rb', line 64

def wait_for_element_hide!(locator, timeout=$conf["implicit_wait"], focus_driver = $focus_driver)
  wait_for_element_hide(locator, timeout, focus_driver)
  case locator
  when RoboTest::Locator
    raise "Element is not hidden !!!" if locator.is_present?
  when RoboTest::MultiLocator
    raise "No element is hidden !!!" if locator.is_present?.include?(true)
  end
end