Module: TableHelper
- Defined in:
- lib/watir_helper/table_helper.rb
Instance Method Summary collapse
-
#exists_table?(browser_handle, property, property_value) ⇒ Boolean
Check whether a table exists or not.
-
#flash_table(browser_handle, property, property_value) ⇒ Object
Highlight or Flash a table.
- #get_a_cell_content(browser_handle, property, property_value, row_num, col_num) ⇒ Object
-
#get_noc_table(browser_handle, property, property_value) ⇒ Object
Get no.
-
#get_nor_table(browser_handle, property, property_value) ⇒ Object
Get no.
-
#get_row_contents(browser_handle, property, property_value, row_num) ⇒ Object
Get contents of a particular row no.
-
#get_table_contents(browser_handle, property, property_value) ⇒ Object
Get the table contents.
Instance Method Details
#exists_table?(browser_handle, property, property_value) ⇒ Boolean
Check whether a table exists or not.
14 15 16 |
# File 'lib/watir_helper/table_helper.rb', line 14 def exists_table?(browser_handle, property, property_value) browser_handle.table(property.intern, /#{property_value}/).exists? end |
#flash_table(browser_handle, property, property_value) ⇒ Object
Highlight or Flash a table.
9 10 11 |
# File 'lib/watir_helper/table_helper.rb', line 9 def flash_table(browser_handle, property, property_value) browser_handle.table(property.intern, /#{property_value}/).flash end |
#get_a_cell_content(browser_handle, property, property_value, row_num, col_num) ⇒ Object
23 24 25 |
# File 'lib/watir_helper/table_helper.rb', line 23 def get_a_cell_content(browser_handle, property, property_value, row_num, col_num) browser_handle.table(property.intern, /#{property_value}/)[row_num - 1][col_num - 1].text end |
#get_noc_table(browser_handle, property, property_value) ⇒ Object
Get no. of cols of a table
33 34 35 |
# File 'lib/watir_helper/table_helper.rb', line 33 def get_noc_table(browser_handle, property, property_value) browser_handle.table(property.intern, /#{property_value}/).row.cells.length end |
#get_nor_table(browser_handle, property, property_value) ⇒ Object
Get no. of rows of a table
28 29 30 |
# File 'lib/watir_helper/table_helper.rb', line 28 def get_nor_table(browser_handle, property, property_value) browser_handle.table(property.intern, /#{property_value}/).rows.length end |
#get_row_contents(browser_handle, property, property_value, row_num) ⇒ Object
Get contents of a particular row no. of a table
19 20 21 |
# File 'lib/watir_helper/table_helper.rb', line 19 def get_row_contents(browser_handle, property, property_value, row_num) browser_handle.table(property.intern, /#{property_value}/)[row_num - 1].text end |
#get_table_contents(browser_handle, property, property_value) ⇒ Object
Get the table contents.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/watir_helper/table_helper.rb', line 38 def get_table_contents(browser_handle, property, property_value) content_arr = [] nor = get_nor_table(browser_handle, property, property_value) noc = get_noc_table(browser_handle, property, property_value) nor.times do |row_num| noc.times do |col_num| content_arr << browser_handle.table(property.intern, /#{property_value}/)[row_num][col_num].text end end content_arr end |