testcentricity_web 2.1.8.2 → 2.1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +27 -0
- data/.rubocop.yml +41 -0
- data/.yardopts +2 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +28 -0
- data/README.md +1438 -0
- data/Rakefile +1 -0
- data/lib/devices/devices.yml +280 -0
- data/lib/testcentricity_web.rb +140 -0
- data/lib/testcentricity_web/browser_helper.rb +173 -0
- data/lib/testcentricity_web/data_objects_helper.rb +78 -0
- data/lib/testcentricity_web/drag_drop_helper.rb +15 -0
- data/lib/testcentricity_web/elements/button.rb +8 -0
- data/lib/testcentricity_web/elements/cell_button.rb +8 -0
- data/lib/testcentricity_web/elements/cell_checkbox.rb +38 -0
- data/lib/testcentricity_web/elements/cell_element.rb +62 -0
- data/lib/testcentricity_web/elements/cell_image.rb +8 -0
- data/lib/testcentricity_web/elements/cell_radio.rb +31 -0
- data/lib/testcentricity_web/elements/checkbox.rb +99 -0
- data/lib/testcentricity_web/elements/file_field.rb +45 -0
- data/lib/testcentricity_web/elements/image.rb +34 -0
- data/lib/testcentricity_web/elements/label.rb +8 -0
- data/lib/testcentricity_web/elements/link.rb +8 -0
- data/lib/testcentricity_web/elements/list.rb +54 -0
- data/lib/testcentricity_web/elements/list_button.rb +8 -0
- data/lib/testcentricity_web/elements/list_checkbox.rb +38 -0
- data/lib/testcentricity_web/elements/list_element.rb +51 -0
- data/lib/testcentricity_web/elements/list_radio.rb +31 -0
- data/lib/testcentricity_web/elements/radio.rb +73 -0
- data/lib/testcentricity_web/elements/select_list.rb +189 -0
- data/lib/testcentricity_web/elements/table.rb +473 -0
- data/lib/testcentricity_web/elements/textfield.rb +84 -0
- data/lib/testcentricity_web/environment.rb +249 -0
- data/lib/testcentricity_web/excel_helper.rb +242 -0
- data/lib/testcentricity_web/exception_queue_helper.rb +47 -0
- data/lib/testcentricity_web/page_objects_helper.rb +656 -0
- data/lib/testcentricity_web/page_sections_helper.rb +811 -0
- data/lib/testcentricity_web/siebel_open_ui_helper.rb +15 -0
- data/lib/testcentricity_web/ui_elements_helper.rb +425 -0
- data/lib/testcentricity_web/utility_helpers.rb +28 -0
- data/lib/testcentricity_web/version.rb +3 -0
- data/lib/testcentricity_web/webdriver_helper.rb +451 -0
- data/lib/testcentricity_web/world_extensions.rb +26 -0
- data/testcentricity_web.gemspec +42 -0
- metadata +52 -4
@@ -0,0 +1,473 @@
|
|
1
|
+
module TestCentricity
|
2
|
+
class Table < UIElement
|
3
|
+
attr_accessor :table_body
|
4
|
+
attr_accessor :table_section
|
5
|
+
attr_accessor :table_row
|
6
|
+
attr_accessor :table_column
|
7
|
+
attr_accessor :table_header
|
8
|
+
attr_accessor :header_row
|
9
|
+
attr_accessor :header_column
|
10
|
+
attr_accessor :tree_expand
|
11
|
+
attr_accessor :tree_collapse
|
12
|
+
|
13
|
+
def initialize(name, parent, locator, context)
|
14
|
+
super
|
15
|
+
@type = :table
|
16
|
+
|
17
|
+
table_spec = { :table_body => 'tbody',
|
18
|
+
:table_section => nil,
|
19
|
+
:table_row => 'tr',
|
20
|
+
:table_column => 'td',
|
21
|
+
:table_header => 'thead',
|
22
|
+
:header_row => 'tr',
|
23
|
+
:header_column => 'th',
|
24
|
+
:tree_expand => "div/div[contains(@class, 'tree-plus treeclick')]",
|
25
|
+
:tree_collapse => "div/div[contains(@class, 'tree-minus treeclick')]" }
|
26
|
+
define_table_elements(table_spec)
|
27
|
+
end
|
28
|
+
|
29
|
+
def define_table_elements(element_spec)
|
30
|
+
element_spec.each do |element, value|
|
31
|
+
case element
|
32
|
+
when :table_body
|
33
|
+
@table_body = value
|
34
|
+
when :table_section
|
35
|
+
@table_section = value
|
36
|
+
when :table_row
|
37
|
+
@table_row = value
|
38
|
+
when :table_column
|
39
|
+
@table_column = value
|
40
|
+
when :table_header
|
41
|
+
@table_header = value
|
42
|
+
when :header_row
|
43
|
+
@header_row = value
|
44
|
+
when :header_column
|
45
|
+
@header_column = value
|
46
|
+
when :tree_expand
|
47
|
+
@tree_expand = value
|
48
|
+
when :tree_collapse
|
49
|
+
@tree_collapse = value
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Return number of rows in a table object.
|
55
|
+
#
|
56
|
+
# @return [Integer]
|
57
|
+
# @example
|
58
|
+
# num_rows = list_table.get_row_count
|
59
|
+
#
|
60
|
+
def get_row_count
|
61
|
+
wait_until_exists(5)
|
62
|
+
if @table_section.nil?
|
63
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}", :visible => :all).count
|
64
|
+
else
|
65
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}", :visible => :all).count
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# Return number of columns in a table object.
|
70
|
+
#
|
71
|
+
# @return [Integer]
|
72
|
+
# @example
|
73
|
+
# num_columns = list_table.get_column_count
|
74
|
+
#
|
75
|
+
def get_column_count
|
76
|
+
row_count = get_row_count
|
77
|
+
if row_count == 0
|
78
|
+
page.all(:xpath, "#{@locator}/#{@table_header}/#{@header_row}/#{@header_column}", :visible => :all).count
|
79
|
+
else
|
80
|
+
if @table_section.nil?
|
81
|
+
row_count == 1 ?
|
82
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}/#{@table_column}", :visible => :all).count :
|
83
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_row}[2]/#{@table_column}", :visible => :all).count
|
84
|
+
else
|
85
|
+
row_count == 1 ?
|
86
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}/#{@table_row}/#{@table_column}", :visible => :all).count :
|
87
|
+
page.all(:xpath, "#{@locator}/#{@table_body}/#{@table_section}[2]/#{@table_row}/#{@table_column}", :visible => :all).count
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Hover over the specified cell in a table object.
|
93
|
+
#
|
94
|
+
# @param row [Integer] row number
|
95
|
+
# @param column [Integer] column number
|
96
|
+
# @example
|
97
|
+
# list_table.hover_table_cell(2, 6)
|
98
|
+
#
|
99
|
+
def hover_table_cell(row, column)
|
100
|
+
row_count = get_row_count
|
101
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
102
|
+
column_count = get_column_count
|
103
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{object_ref_message}" if column > column_count
|
104
|
+
set_table_cell_locator(row, column)
|
105
|
+
hover
|
106
|
+
clear_alt_locator
|
107
|
+
end
|
108
|
+
|
109
|
+
# Click in the specified cell in a table object.
|
110
|
+
#
|
111
|
+
# @param row [Integer] row number
|
112
|
+
# @param column [Integer] column number
|
113
|
+
# @example
|
114
|
+
# list_table.click_table_cell(3, 5)
|
115
|
+
#
|
116
|
+
def click_table_cell(row, column)
|
117
|
+
row_count = get_row_count
|
118
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
119
|
+
column_count = get_column_count
|
120
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{object_ref_message}" if column > column_count
|
121
|
+
set_table_cell_locator(row, column)
|
122
|
+
click
|
123
|
+
clear_alt_locator
|
124
|
+
end
|
125
|
+
|
126
|
+
# Double-click in the specified cell in a table object.
|
127
|
+
#
|
128
|
+
# @param row [Integer] row number
|
129
|
+
# @param column [Integer] column number
|
130
|
+
# @example
|
131
|
+
# list_table.double_click_table_cell(3, 5)
|
132
|
+
#
|
133
|
+
def double_click_table_cell(row, column)
|
134
|
+
row_count = get_row_count
|
135
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
136
|
+
column_count = get_column_count
|
137
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{object_ref_message}" if column > column_count
|
138
|
+
set_table_cell_locator(row, column)
|
139
|
+
double_click
|
140
|
+
clear_alt_locator
|
141
|
+
end
|
142
|
+
|
143
|
+
# Click the link object embedded within the specified cell in a table object.
|
144
|
+
#
|
145
|
+
# @param row [Integer] row number
|
146
|
+
# @param column [Integer] column number
|
147
|
+
# @example
|
148
|
+
# list_table.click_table_cell_link(3, 1)
|
149
|
+
#
|
150
|
+
def click_table_cell_link(row, column)
|
151
|
+
row_count = get_row_count
|
152
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
153
|
+
column_count = get_column_count
|
154
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{object_ref_message}" if column > column_count
|
155
|
+
set_table_cell_locator(row, column)
|
156
|
+
saved_locator = @alt_locator
|
157
|
+
set_alt_locator("#{@alt_locator}//a")
|
158
|
+
set_alt_locator("#{saved_locator}//span/a") unless exists?
|
159
|
+
# if link not present, check for text entry fields and try to dismiss by tabbing out
|
160
|
+
unless exists?
|
161
|
+
set_alt_locator("#{saved_locator}//input")
|
162
|
+
set_alt_locator("#{saved_locator}//textarea") unless exists?
|
163
|
+
send_keys(:tab) if exists?
|
164
|
+
set_alt_locator("#{saved_locator}//a")
|
165
|
+
set_alt_locator("#{saved_locator}//span/a") unless exists?
|
166
|
+
send_keys(:tab) unless exists?
|
167
|
+
end
|
168
|
+
wait_until_exists(1)
|
169
|
+
click
|
170
|
+
clear_alt_locator
|
171
|
+
end
|
172
|
+
|
173
|
+
def get_table_row(row)
|
174
|
+
columns = []
|
175
|
+
row_count = get_row_count
|
176
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
177
|
+
column_count = get_column_count
|
178
|
+
(1..column_count).each do |column|
|
179
|
+
value = ''
|
180
|
+
set_table_cell_locator(row, column)
|
181
|
+
saved_locator = @alt_locator
|
182
|
+
set_alt_locator("#{saved_locator}//input")
|
183
|
+
unless exists?
|
184
|
+
set_alt_locator("#{saved_locator}//textarea")
|
185
|
+
set_alt_locator(saved_locator) unless exists?
|
186
|
+
end
|
187
|
+
value = get_value if exists?
|
188
|
+
columns.push(value)
|
189
|
+
end
|
190
|
+
clear_alt_locator
|
191
|
+
columns
|
192
|
+
end
|
193
|
+
|
194
|
+
def get_row_data(row)
|
195
|
+
row_count = get_row_count
|
196
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
197
|
+
row > 1 ?
|
198
|
+
set_alt_locator("#{@locator}/#{@table_body}/#{@table_row}[#{row}]") :
|
199
|
+
set_alt_locator("#{@locator}/#{@table_body}/#{@table_row}")
|
200
|
+
value = get_value if exists?
|
201
|
+
clear_alt_locator
|
202
|
+
value
|
203
|
+
end
|
204
|
+
|
205
|
+
def get_table_column(column)
|
206
|
+
rows = []
|
207
|
+
column_count = get_column_count
|
208
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{object_ref_message}" if column > column_count
|
209
|
+
row_count = get_row_count
|
210
|
+
(1..row_count).each do |row|
|
211
|
+
value = ''
|
212
|
+
set_table_cell_locator(row, column)
|
213
|
+
saved_locator = @alt_locator
|
214
|
+
set_alt_locator("#{saved_locator}//input")
|
215
|
+
unless exists?
|
216
|
+
set_alt_locator("#{saved_locator}//textarea")
|
217
|
+
set_alt_locator(saved_locator) unless exists?
|
218
|
+
end
|
219
|
+
value = get_value if exists?
|
220
|
+
rows.push(value)
|
221
|
+
end
|
222
|
+
clear_alt_locator
|
223
|
+
rows
|
224
|
+
end
|
225
|
+
|
226
|
+
# Return text contained in specified cell of a table object.
|
227
|
+
#
|
228
|
+
# @param row [Integer] row number
|
229
|
+
# @param column [Integer] column number
|
230
|
+
# @return [String] value of table cell
|
231
|
+
# @example
|
232
|
+
# list_table.get_table_cell(4, 5)
|
233
|
+
#
|
234
|
+
def get_table_cell(row, column)
|
235
|
+
row_count = get_row_count
|
236
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
237
|
+
column_count = get_column_count
|
238
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{object_ref_message}" if column > column_count
|
239
|
+
set_table_cell_locator(row, column)
|
240
|
+
saved_locator = @alt_locator
|
241
|
+
set_alt_locator("#{saved_locator}//input")
|
242
|
+
unless exists?
|
243
|
+
set_alt_locator("#{saved_locator}//textarea")
|
244
|
+
set_alt_locator(saved_locator) unless exists?
|
245
|
+
end
|
246
|
+
if exists?
|
247
|
+
value = get_value
|
248
|
+
else
|
249
|
+
puts "Could not find table cell at #{@alt_locator}"
|
250
|
+
value = ''
|
251
|
+
end
|
252
|
+
clear_alt_locator
|
253
|
+
value
|
254
|
+
end
|
255
|
+
|
256
|
+
def verify_table_cell(row, column, expected, enqueue = false)
|
257
|
+
actual = get_table_cell(row, column)
|
258
|
+
enqueue ?
|
259
|
+
ExceptionQueue.enqueue_assert_equal(expected.strip, actual.strip, "Expected table #{object_ref_message} row #{row}/column #{column}") :
|
260
|
+
assert_equal(expected.strip, actual.strip, "Expected table #{object_ref_message} row #{row}/column #{column} to display '#{expected}' but found '#{actual}'")
|
261
|
+
end
|
262
|
+
|
263
|
+
# Set the value of the specified cell in a table object.
|
264
|
+
#
|
265
|
+
# @param row [Integer] row number
|
266
|
+
# @param column [Integer] column number
|
267
|
+
# @param value [String] text to set
|
268
|
+
# @example
|
269
|
+
# list_table.set_table_cell(3, 1, 'Ontario')
|
270
|
+
#
|
271
|
+
def set_table_cell(row, column, value)
|
272
|
+
row_count = get_row_count
|
273
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
274
|
+
find_table_cell(row, column)
|
275
|
+
find_table_cell(row, column) unless exists?
|
276
|
+
set(value)
|
277
|
+
clear_alt_locator
|
278
|
+
end
|
279
|
+
|
280
|
+
def get_cell_attribute(row, column, attrib)
|
281
|
+
row_count = get_row_count
|
282
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
283
|
+
column_count = get_column_count
|
284
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{object_ref_message}" if column > column_count
|
285
|
+
set_table_cell_locator(row, column)
|
286
|
+
result = get_native_attribute(attrib)
|
287
|
+
clear_alt_locator
|
288
|
+
result
|
289
|
+
end
|
290
|
+
|
291
|
+
def get_row_attribute(row, attrib)
|
292
|
+
row_count = get_row_count
|
293
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
294
|
+
row > 1 ?
|
295
|
+
set_alt_locator("#{@locator}/#{@table_body}/#{@table_row}[#{row}]") :
|
296
|
+
set_alt_locator("#{@locator}/#{@table_body}/#{@table_row}")
|
297
|
+
result = get_native_attribute(attrib)
|
298
|
+
clear_alt_locator
|
299
|
+
result
|
300
|
+
end
|
301
|
+
|
302
|
+
def find_row_attribute(attrib, search_value)
|
303
|
+
(1..get_row_count).each do |row|
|
304
|
+
return row if get_row_attribute(row, attrib) == search_value
|
305
|
+
end
|
306
|
+
nil
|
307
|
+
end
|
308
|
+
|
309
|
+
# Search for the specified text value in the specified row of the table object.
|
310
|
+
# Returns the number of the first column that contains the search value.
|
311
|
+
#
|
312
|
+
# @param row [Integer] row nummber
|
313
|
+
# @param search_value [String] value to be searched for
|
314
|
+
# @return [Integer] column number of table cell that contains search value
|
315
|
+
# @example
|
316
|
+
# bom_table.find_in_table_row(4, 'High-speed Framus bolts')
|
317
|
+
#
|
318
|
+
def find_in_table_row(row, search_value)
|
319
|
+
(1..get_column_count).each do |column|
|
320
|
+
return column if get_table_cell(row, column) == search_value
|
321
|
+
end
|
322
|
+
nil
|
323
|
+
end
|
324
|
+
|
325
|
+
# Search for the specified text value in the specified column of the table object.
|
326
|
+
# Returns the number of the first row that contains the search value.
|
327
|
+
#
|
328
|
+
# @param column [Integer] column nummber
|
329
|
+
# @param search_value [String] value to be searched for
|
330
|
+
# @return [Integer] row number of table cell that contains search value
|
331
|
+
# @example
|
332
|
+
# playlist_table.find_in_table_column(1, 'Ashes to Ashes')
|
333
|
+
#
|
334
|
+
def find_in_table_column(column, search_value)
|
335
|
+
(1..get_row_count).each do |row|
|
336
|
+
return row if get_table_cell(row, column) == search_value
|
337
|
+
end
|
338
|
+
nil
|
339
|
+
end
|
340
|
+
|
341
|
+
# Populate the specified row of this table object with the associated data from a Hash passed as an
|
342
|
+
# argument. Data values must be in the form of a String for textfield and select list controls. For checkbox
|
343
|
+
# and radio buttons, data must either be a Boolean or a String that evaluates to a Boolean value (Yes, No, 1,
|
344
|
+
# 0, true, false)
|
345
|
+
#
|
346
|
+
# @param data [Hash] column numbers and associated data to be entered
|
347
|
+
# @example
|
348
|
+
# data = { 1 => 'Dr.',
|
349
|
+
# 2 => 'Evangeline',
|
350
|
+
# 3 => 'Devereaux',
|
351
|
+
# 4 => 'MD',
|
352
|
+
# 5 => 'Family Practice'
|
353
|
+
# }
|
354
|
+
# clinicians_table.populate_table_row(3, data)
|
355
|
+
#
|
356
|
+
def populate_table_row(row, data)
|
357
|
+
wait_until_exists(2)
|
358
|
+
data.each do |column, data_param|
|
359
|
+
unless data_param.blank?
|
360
|
+
if data_param == '!DELETE'
|
361
|
+
set_table_cell(row, column, '')
|
362
|
+
else
|
363
|
+
set_table_cell(row, column, data_param)
|
364
|
+
end
|
365
|
+
end
|
366
|
+
end
|
367
|
+
end
|
368
|
+
|
369
|
+
# Click in the specified column header in a table object.
|
370
|
+
#
|
371
|
+
# @param column [Integer] column number
|
372
|
+
# @example
|
373
|
+
# list_table.click_header_column(3)
|
374
|
+
#
|
375
|
+
def click_header_column(column)
|
376
|
+
column_count = get_column_count
|
377
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table header #{object_ref_message}" if column > column_count
|
378
|
+
set_alt_locator("#{@locator}//#{@table_header}/#{@header_row}/#{@header_column}[#{column}]")
|
379
|
+
click if exists?
|
380
|
+
clear_alt_locator
|
381
|
+
end
|
382
|
+
|
383
|
+
def get_header_column(column)
|
384
|
+
column_count = get_column_count
|
385
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table header #{object_ref_message}" if column > column_count
|
386
|
+
set_alt_locator("#{@locator}//#{@table_header}/#{@header_row}/#{@header_column}[#{column}]")
|
387
|
+
value = get_value(:all) if exists?(:all)
|
388
|
+
clear_alt_locator
|
389
|
+
value
|
390
|
+
end
|
391
|
+
|
392
|
+
def get_header_columns
|
393
|
+
columns = []
|
394
|
+
column_count = get_column_count
|
395
|
+
(1..column_count).each do |column|
|
396
|
+
set_alt_locator("#{@locator}//#{@table_header}/#{@header_row}/#{@header_column}[#{column}]")
|
397
|
+
columns.push(get_value(:all)) if exists?(:all)
|
398
|
+
end
|
399
|
+
clear_alt_locator
|
400
|
+
columns
|
401
|
+
end
|
402
|
+
|
403
|
+
def is_table_row_expanded?(row, column)
|
404
|
+
row_count = get_row_count
|
405
|
+
raise "Row #{row} exceeds number of rows (#{row_count}) in table #{object_ref_message}" if row > row_count
|
406
|
+
column_count = get_column_count
|
407
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{object_ref_message}" if column > column_count
|
408
|
+
set_table_cell_locator(row, column)
|
409
|
+
set_alt_locator("#{@alt_locator}/#{@tree_expand}")
|
410
|
+
expanded = true
|
411
|
+
expanded = false if exists?
|
412
|
+
clear_alt_locator
|
413
|
+
expanded
|
414
|
+
end
|
415
|
+
|
416
|
+
def expand_table_row(row, column)
|
417
|
+
unless is_table_row_expanded?(row, column)
|
418
|
+
set_table_cell_locator(row, column)
|
419
|
+
set_alt_locator("#{@alt_locator}/#{@tree_expand}")
|
420
|
+
click if exists?
|
421
|
+
clear_alt_locator
|
422
|
+
end
|
423
|
+
end
|
424
|
+
|
425
|
+
def collapse_table_row(row, column)
|
426
|
+
if is_table_row_expanded?(row, column)
|
427
|
+
set_table_cell_locator(row, column)
|
428
|
+
set_alt_locator("#{@alt_locator}/#{@tree_collapse}")
|
429
|
+
click if exists?
|
430
|
+
clear_alt_locator
|
431
|
+
end
|
432
|
+
end
|
433
|
+
|
434
|
+
def expand_all_table_rows(column)
|
435
|
+
row_count = get_row_count
|
436
|
+
column_count = get_column_count
|
437
|
+
raise "Column #{column} exceeds number of columns (#{column_count}) in table #{object_ref_message}" if column > column_count
|
438
|
+
row_count.downto(1) do |row|
|
439
|
+
expand_table_row(row, column)
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
def get_table_cell_locator(row, column)
|
444
|
+
if @table_section.nil?
|
445
|
+
row_spec = "#{@locator}/#{@table_body}/#{@table_row}"
|
446
|
+
row_spec = "#{row_spec}[#{row}]"
|
447
|
+
else
|
448
|
+
row_spec = "#{@locator}/#{@table_body}/#{@table_section}"
|
449
|
+
row_spec = "#{row_spec}[#{row}]/#{@table_row}[1]"
|
450
|
+
end
|
451
|
+
column_spec = "/#{@table_column}[#{column}]"
|
452
|
+
"#{row_spec}#{column_spec}"
|
453
|
+
end
|
454
|
+
|
455
|
+
private
|
456
|
+
|
457
|
+
def set_table_cell_locator(row, column)
|
458
|
+
set_alt_locator(get_table_cell_locator(row, column))
|
459
|
+
end
|
460
|
+
|
461
|
+
def find_table_cell(row, column)
|
462
|
+
set_table_cell_locator(row, column)
|
463
|
+
if exists?
|
464
|
+
click
|
465
|
+
else
|
466
|
+
puts "Could not find table cell at #{@alt_locator}"
|
467
|
+
end
|
468
|
+
saved_locator = @alt_locator
|
469
|
+
set_alt_locator("#{saved_locator}//input")
|
470
|
+
set_alt_locator("#{saved_locator}//textarea") unless exists?
|
471
|
+
end
|
472
|
+
end
|
473
|
+
end
|