watir_helper 0.1.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,10 @@
1
- require 'watir'
1
+ #******************************************************
2
+ #Common Helpers
3
+ #******************************************************
2
4
  require 'rubygems'
5
+ require 'watir'
6
+ require 'rautomation'
7
+ require File.expand_path('data_type_validations', File.dirname(__FILE__))
8
+ include DataTypeValidationsHelper
3
9
 
4
10
 
5
- #Create a new instance of IE.
6
- $ie=Watir::IE.new
7
- #Initialize variable "settext" with the value nil.
8
- $settext=nil
9
-
@@ -0,0 +1,36 @@
1
+ #******************************************************
2
+ #DataType Validation methods
3
+ #******************************************************
4
+ module DataTypeValidationsHelper
5
+
6
+ #Check whether the value entered is an Integer or not.
7
+ def is_integer?(value)
8
+ value.is_a?(Integer)
9
+ end
10
+
11
+ #Check whether the value entered is a Float or not.
12
+ def is_float?(value)
13
+ value.is_a?(Float)
14
+ end
15
+
16
+ #Check whether the value entered is a String or not.
17
+ def is_string?(value)
18
+ value.is_a?(String)
19
+ end
20
+
21
+ #Check whether the value entered is a Regular Expression or not.
22
+ def is_reg_exp?(value)
23
+ value.is_a?(Regexp)
24
+ end
25
+
26
+ #Check whether the value entered is a Range or not.
27
+ def is_range?(value)
28
+ value.is_a?(Range)
29
+ end
30
+
31
+ #Check whether the value entered is a Character or not.
32
+ def is_char?(value) #Like "3", 3, "a", 'a', '!', '~' etc.
33
+ (value.to_s).length == 1
34
+ end
35
+
36
+ end
@@ -1,41 +1,38 @@
1
- require 'watir_helper/common_helpers'
1
+ #******************************************************
2
+ #Div methods
3
+ #******************************************************
4
+ require File.expand_path('common_helpers', File.dirname(__FILE__))
2
5
 
3
6
  module DivHelper
4
7
 
5
8
  #Click a div.
6
- def click_div(property,propertyvalue)
7
- propertyvalue=/#{propertyvalue}/
8
- $ie.div(property.intern,propertyvalue).click
9
+ def click_div(browser_handle, property, property_value)
10
+ browser_handle.div(property.intern, /#{property_value}/).click
9
11
  end
10
12
 
11
13
  #Click a div, after clicking which a pop-up will come.
12
- def click_div_with_popup(property,propertyvalue)
13
- propertyvalue=/#{propertyvalue}/
14
- $ie.div(property.intern,propertyvalue).click_no_wait
14
+ def click_div_with_popup(browser_handle, property, property_value)
15
+ browser_handle.div(property.intern, /#{property_value}/).click_no_wait
15
16
  end
16
17
 
17
18
  #Double Click a div.
18
- def double_click_div(property,propertyvalue)
19
- propertyvalue=/#{propertyvalue}/
20
- $ie.div(property.intern,propertyvalue).fire_event("ondblclick")
19
+ def double_click_div(browser_handle, property, property_value)
20
+ browser_handle.div(property.intern, /#{property_value}/).fire_event("ondblclick")
21
21
  end
22
22
 
23
23
  #Double Click a div, after clicking which a pop-up will come.
24
- def double_click_div_with_popup(property,propertyvalue)
25
- propertyvalue=/#{propertyvalue}/
26
- $ie.div(property.intern,propertyvalue).fire_event_no_wait("ondblclick")
24
+ def double_click_div_with_popup(browser_handle, property, property_value)
25
+ browser_handle.div(property.intern, /#{property_value}/).fire_event_no_wait("ondblclick")
27
26
  end
28
27
 
29
28
  #Highlight or Flash a div.
30
- def flash_div(property,propertyvalue)
31
- propertyvalue=/#{propertyvalue}/
32
- $ie.div(property.intern,propertyvalue).flash
29
+ def flash_div(browser_handle, property, property_value)
30
+ browser_handle.div(property.intern, /#{property_value}/).flash
33
31
  end
34
32
 
35
33
  #Check whether a div exists or not.
36
- def exists_div(property,propertyvalue)
37
- propertyvalue=/#{propertyvalue}/
38
- $ie.div(property.intern,propertyvalue).exists?
34
+ def exists_div?(browser_handle, property, property_value)
35
+ browser_handle.div(property.intern, /#{property_value}/).exists?
39
36
  end
40
37
 
41
38
  end
@@ -1,89 +1,168 @@
1
- require 'watir_helper/common_helpers'
1
+ #******************************************************
2
+ #Frame methods
3
+ #******************************************************
4
+ require File.expand_path('common_helpers', File.dirname(__FILE__))
2
5
 
3
6
  module FrameHelper
4
7
 
5
8
  #Click a link inside a frame.
6
- def click_link_inside_frame(frame_prop,frame_prop_val,link_prop,link_prop_val)
7
- frame_prop_val=/#{frame_prop_val}/
8
- link_prop_val=/#{link_prop_val}/
9
- $ie.frame(frame_prop.intern,frame_prop_val).link(link_prop.intern,link_prop_val).click
9
+ def click_link_inside_frame(browser_handle, frame_prop, frame_prop_val, link_prop, link_prop_val)
10
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).link(link_prop.intern, /#{link_prop_val}/).click
10
11
  end
11
12
 
12
- #Click a button inside a frame.
13
- def click_button_inside_frame(frame_prop,frame_prop_val,button_prop,button_prop_val)
14
- frame_prop_val=/#{frame_prop_val}/
15
- button_prop_val=/#{button_prop_val}/
16
- $ie.frame(frame_prop.intern,frame_prop_val).button(button_prop.intern,button_prop_val).click
13
+ #Click a link(inside a frame), after clicking it a pop-up will come.
14
+ def click_link_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, link_prop, link_prop_val)
15
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).link(link_prop.intern, /#{link_prop_val}/).click_no_wait
17
16
  end
18
17
 
19
- #Click an image inside a frame.
20
- def click_image_inside_frame(frame_prop,frame_prop_val,image_prop,image_prop_val)
21
- frame_prop_val=/#{frame_prop_val}/
22
- image_prop_val=/#{image_prop_val}/
23
- $ie.frame(frame_prop.intern,frame_prop_val).image(image_prop.intern,image_prop_val).click
18
+ #Highlight or Flash a link inside a frame.
19
+ def flash_link_inside_frame(browser_handle, frame_prop, frame_prop_val, link_prop, link_prop_val)
20
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).link(link_prop.intern, /#{link_prop_val}/).flash
24
21
  end
25
22
 
26
- #Click a checkbox inside a frame.
27
- def click_checkbox_inside_frame(frame_prop,frame_prop_val,checkbox_prop,checkbox_prop_val)
28
- frame_prop_val=/#{frame_prop_val}/
29
- checkbox_prop_val=/#{checkbox_prop_val}/
30
- $ie.frame(frame_prop.intern,frame_prop_val).checkbox(checkbox_prop.intern,checkbox_prop_val).click
23
+ #Link exists inside a frame.
24
+ def link_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, link_prop, link_prop_val)
25
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).link(link_prop.intern, /#{link_prop_val}/).exists?
31
26
  end
32
27
 
33
- #Click a radio button inside a frame.
34
- def click_radio_button_inside_frame(frame_prop,frame_prop_val,radio_prop,radio_prop_val)
35
- frame_prop_val=/#{frame_prop_val}/
36
- radio_prop_val=/#{radio_prop_val}/
37
- $ie.frame(frame_prop.intern,frame_prop_val).radio(radio_prop.intern,radio_prop_val).click
28
+ #Click a button inside a frame.
29
+ def click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)
30
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).click
38
31
  end
39
32
 
40
- #Select from a select list inside a frame.
41
- def select_from_select_list_inside_frame(frame_prop,frame_prop_val,select_list_prop,select_list_prop_val,select_value)
42
- frame_prop_val=/#{frame_prop_val}/
43
- select_list_prop_val=/#{select_list_prop_val}/
44
- $ie.frame(frame_prop.intern,frame_prop_val).select_list(select_list_prop.intern,select_list_prop_val).select(select_value)
33
+ #Click a button(inside a frame), after clicking it a pop-up will come.
34
+ def click_button_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)
35
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).click_no_wait
45
36
  end
46
37
 
47
- #Highlight or Flash a link inside a frame.
48
- def flash_link_inside_frame(frame_prop,frame_prop_val,link_prop,link_prop_val)
49
- frame_prop_val=/#{frame_prop_val}/
50
- link_prop_val=/#{link_prop_val}/
51
- $ie.frame(frame_prop.intern,frame_prop_val).link(link_prop.intern,link_prop_val).flash
38
+ #Double Click a button.
39
+ def double_click_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)
40
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).fire_event("ondblclick")
41
+ end
42
+
43
+ #Double Click a button(inside a frame), after clicking it a pop-up will come.
44
+ def double_click_button_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)
45
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).fire_event_no_wait("ondblclick")
52
46
  end
53
47
 
54
48
  #Highlight or Flash a button inside a frame.
55
- def flash_button_inside_frame(frame_prop,frame_prop_val,button_prop,button_prop_val)
56
- frame_prop_val=/#{frame_prop_val}/
57
- button_prop_val=/#{button_prop_val}/
58
- $ie.frame(frame_prop.intern,frame_prop_val).button(button_prop.intern,button_prop_val).flash
49
+ def flash_button_inside_frame(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)
50
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).flash
51
+ end
52
+
53
+ #Button exists inside a frame.
54
+ def button_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, button_prop, button_prop_val)
55
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).button(button_prop.intern, /#{button_prop_val}/).exists?
56
+ end
57
+
58
+ #Click an image inside a frame.
59
+ def click_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)
60
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).click
61
+ end
62
+
63
+ #Click an image(inside a frame), after clicking it a pop-up will come.
64
+ def click_image_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)
65
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).click_no_wait
66
+ end
67
+
68
+ #Double Click an image inside a frame.
69
+ def double_click_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)
70
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).fire_event("ondblclick")
71
+ end
72
+
73
+ #Double Click an image(inside a frame), after clicking it a pop-up will come.
74
+ def double_click_image_with_popup_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)
75
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).fire_event_no_wait("ondblclick")
59
76
  end
60
77
 
61
78
  #Highlight or Flash an image inside a frame.
62
- def flash_image_inside_frame(frame_prop,frame_prop_val,image_prop,image_prop_val)
63
- frame_prop_val=/#{frame_prop_val}/
64
- image_prop_val=/#{image_prop_val}/
65
- $ie.frame(frame_prop.intern,frame_prop_val).image(image_prop.intern,image_prop_val).flash
79
+ def flash_image_inside_frame(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)
80
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).flash
81
+ end
82
+
83
+ #Image exists inside a frame.
84
+ def image_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, image_prop, image_prop_val)
85
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).image(image_prop.intern, /#{image_prop_val}/).exists?
86
+ end
87
+
88
+ #Click a checkbox inside a frame.
89
+ def click_checkbox_inside_frame(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val)
90
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).click
91
+ end
92
+
93
+ #Clear a checkbox inside a frame.
94
+ def clear_checkbox_inside_frame(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val)
95
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).clear
66
96
  end
67
97
 
68
98
  #Highlight or Flash a checkbox inside a frame.
69
- def flash_checkbox_inside_frame(frame_prop,frame_prop_val,checkbox_prop,checkbox_prop_val)
70
- frame_prop_val=/#{frame_prop_val}/
71
- checkbox_prop_val=/#{checkbox_prop_val}/
72
- $ie.frame(frame_prop.intern,frame_prop_val).checkbox(checkbox_prop.intern,checkbox_prop_val).flash
99
+ def flash_checkbox_inside_frame(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val)
100
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).flash
101
+ end
102
+
103
+ #Checkbox exists inside a frame.
104
+ def checkbox_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val)
105
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).exists?
106
+ end
107
+
108
+ #Check whether a checkbox is checked/set or not inside a frame.
109
+ def checkbox_checked_inside_frame?(browser_handle, frame_prop, frame_prop_val, checkbox_prop, checkbox_prop_val)
110
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).checkbox(checkbox_prop.intern, /#{checkbox_prop_val}/).checked?
111
+ end
112
+
113
+ #Click a radio button inside a frame.
114
+ def click_radio_button_inside_frame(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)
115
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).click
116
+ end
117
+
118
+ #Clear a radio button inside a frame.
119
+ def clear_radio_button_inside_frame(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)
120
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).clear
73
121
  end
74
122
 
75
123
  #Highlight or Flash a radio button inside a frame.
76
- def flash_radio_button_inside_frame(frame_prop,frame_prop_val,radio_prop,radio_prop_val)
77
- frame_prop_val=/#{frame_prop_val}/
78
- radio_prop_val=/#{radio_prop_val}/
79
- $ie.frame(frame_prop.intern,frame_prop_val).radio(radio_prop.intern,radio_prop_val).flash
124
+ def flash_radio_button_inside_frame(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)
125
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).flash
126
+ end
127
+
128
+ #Radio button exists inside a frame.
129
+ def radio_button_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)
130
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).exists?
131
+ end
132
+
133
+ #Check whether a radio button is checked or not inside a frame.
134
+ def radio_button_checked_inside_frame?(browser_handle, frame_prop, frame_prop_val, radio_prop, radio_prop_val)
135
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).radio(radio_prop.intern, /#{radio_prop_val}/).checked?
136
+ end
137
+
138
+ #Select from a select list inside a frame.
139
+ def select_from_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val, select_value)
140
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).select(select_value)
141
+ end
142
+
143
+ #Clear selection from a Select list inside a frame.
144
+ def clear_selection_from_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val)
145
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).clearSelection
146
+ end
147
+
148
+ #Get all contents of a Select list inside a frame.
149
+ def get_all_contents_of_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val)
150
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).getAllContents
80
151
  end
81
152
 
82
153
  #Highlight or Flash a select list inside a frame.
83
- def flash_select_list_inside_frame(frame_prop,frame_prop_val,select_list_prop,select_list_prop_val)
84
- frame_prop_val=/#{frame_prop_val}/
85
- select_list_prop_val=/#{select_list_prop_val}/
86
- $ie.frame(frame_prop.intern,frame_prop_val).select_list(select_list_prop.intern,select_list_prop_val).flash
154
+ def flash_select_list_inside_frame(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val)
155
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).flash
156
+ end
157
+
158
+ #Check whether a Select list exists or not inside a frame.
159
+ def select_list_exists_inside_frame?(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val)
160
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).exists?
161
+ end
162
+
163
+ #Check whether a particular value is selected from a Select list or not inside a frame.
164
+ def is_value_selected_from_select_list_inside_frame?(browser_handle, frame_prop, frame_prop_val, select_list_prop, select_list_prop_val, selected_value)
165
+ browser_handle.frame(frame_prop.intern, /#{frame_prop_val}/).select_list(select_list_prop.intern, /#{select_list_prop_val}/).selected?(selected_value)
87
166
  end
88
167
 
89
168
  end
@@ -1,41 +1,38 @@
1
- require 'watir_helper/common_helpers'
1
+ #******************************************************
2
+ #Image methods
3
+ #******************************************************
4
+ require File.expand_path('common_helpers', File.dirname(__FILE__))
2
5
 
3
6
  module ImageHelper
4
7
 
5
8
  #Click an image.
6
- def click_image(property,propertyvalue)
7
- propertyvalue=/#{propertyvalue}/
8
- $ie.image(property.intern,propertyvalue).click
9
+ def click_image(browser_handle, property, property_value)
10
+ browser_handle.image(property.intern, /#{property_value}/).click
9
11
  end
10
12
 
11
13
  #Click an image ,after clicking which a pop-up will come.
12
- def click_image_with_popup(property,propertyvalue)
13
- propertyvalue=/#{propertyvalue}/
14
- $ie.image(property.intern,propertyvalue).click_no_wait
14
+ def click_image_with_popup(browser_handle, property, property_value)
15
+ browser_handle.image(property.intern, /#{property_value}/).click_no_wait
15
16
  end
16
17
 
17
18
  #Double Click an image.
18
- def double_click_image(property,propertyvalue)
19
- propertyvalue=/#{propertyvalue}/
20
- $ie.image(property.intern,propertyvalue).fire_event("ondblclick")
19
+ def double_click_image(browser_handle, property, property_value)
20
+ browser_handle.image(property.intern, /#{property_value}/).fire_event("ondblclick")
21
21
  end
22
22
 
23
23
  #Double Click an image ,after clicking which a pop-up will come.
24
- def double_click_image_with_popup(property,propertyvalue)
25
- propertyvalue=/#{propertyvalue}/
26
- $ie.image(property.intern,propertyvalue).fire_event_no_wait("ondblclick")
24
+ def double_click_image_with_popup(browser_handle, property, property_value)
25
+ browser_handle.image(property.intern, /#{property_value}/).fire_event_no_wait("ondblclick")
27
26
  end
28
27
 
29
28
  #Highlight or Flash an image.
30
- def flash_image(property,propertyvalue)
31
- propertyvalue=/#{propertyvalue}/
32
- $ie.image(property.intern,propertyvalue).flash
29
+ def flash_image(browser_handle, property, property_value)
30
+ browser_handle.image(property.intern, /#{property_value}/).flash
33
31
  end
34
32
 
35
33
  #Check whether an image exists or not.
36
- def exists_image(property,propertyvalue)
37
- propertyvalue=/#{propertyvalue}/
38
- $ie.image(property.intern,propertyvalue).exists?
34
+ def exists_image?(browser_handle, property, property_value)
35
+ browser_handle.image(property.intern, /#{property_value}/).exists?
39
36
  end
40
37
 
41
38
  end
@@ -0,0 +1,44 @@
1
+ #******************************************************
2
+ #Helpers other than Common Helpers
3
+ #******************************************************
4
+ require File.expand_path('button_helper', File.dirname(__FILE__))
5
+ include ButtonHelper
6
+ require File.expand_path('checkbox_helper', File.dirname(__FILE__))
7
+ include CheckBoxHelper
8
+ require File.expand_path('frame_helper', File.dirname(__FILE__))
9
+ include FrameHelper
10
+ require File.expand_path('image_helper', File.dirname(__FILE__))
11
+ include ImageHelper
12
+ require File.expand_path('link_helper', File.dirname(__FILE__))
13
+ include LinkHelper
14
+ require File.expand_path('popup_handling_helper', File.dirname(__FILE__))
15
+ include PopupHelper
16
+ require File.expand_path('radio_button_helper', File.dirname(__FILE__))
17
+ include RadioButtonHelper
18
+ require File.expand_path('select_list_helper', File.dirname(__FILE__))
19
+ include SelectListHelper
20
+ require File.expand_path('textfield_helper', File.dirname(__FILE__))
21
+ include TextFieldHelper
22
+ require File.expand_path('validations_helper', File.dirname(__FILE__))
23
+ include ValidationsHelper
24
+ require File.expand_path('browser_helper', File.dirname(__FILE__))
25
+ include BrowserHelper
26
+ require File.expand_path('login_helper', File.dirname(__FILE__))
27
+ include LoginHelper
28
+ require File.expand_path('span_helper', File.dirname(__FILE__))
29
+ include SpanHelper
30
+ require File.expand_path('table_helper', File.dirname(__FILE__))
31
+ include TableHelper
32
+ require File.expand_path('div_helper', File.dirname(__FILE__))
33
+ include DivHelper
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+
44
+
@@ -1,29 +1,28 @@
1
- require 'watir_helper/common_helpers'
1
+ #******************************************************
2
+ #Link methods
3
+ #******************************************************
4
+ require File.expand_path('common_helpers', File.dirname(__FILE__))
2
5
 
3
6
  module LinkHelper
4
7
 
5
8
  #Click a link.
6
- def click_link(property,propertyvalue)
7
- propertyvalue=/#{propertyvalue}/
8
- $ie.link(property.intern,propertyvalue).click
9
+ def click_link(browser_handle, property, property_value)
10
+ browser_handle.link(property.intern, /#{property_value}/).click
9
11
  end
10
12
 
11
13
  #Click a link ,after clicking which a pop-up will come.
12
- def click_link_with_popup(property,propertyvalue)
13
- propertyvalue=/#{propertyvalue}/
14
- $ie.link(property.intern,propertyvalue).click_no_wait
14
+ def click_link_with_popup(browser_handle, property, property_value)
15
+ browser_handle.link(property.intern, /#{property_value}/).click_no_wait
15
16
  end
16
17
 
17
18
  #Highlight or Flash a link.
18
- def flash_link(property,propertyvalue)
19
- propertyvalue=/#{propertyvalue}/
20
- $ie.link(property.intern,propertyvalue).flash
19
+ def flash_link(browser_handle, property, property_value)
20
+ browser_handle.link(property.intern, /#{property_value}/).flash
21
21
  end
22
22
 
23
23
  #Check whether a link exists or not.
24
- def exists_link(property,propertyvalue)
25
- propertyvalue=/#{propertyvalue}/
26
- $ie.link(property.intern,propertyvalue).exists?
24
+ def exists_link?(browser_handle, property, property_value)
25
+ browser_handle.link(property.intern, /#{property_value}/).exists?
27
26
  end
28
27
 
29
28
  end