Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. browser.td(:text => "Equipment").parent.td(:index => "2").flash
  2.  
  3. browser.tr(:text => "Equipment").flash
  4.  
  5. browser.table[row_index][column_index]
  6.  
  7. browser.table.tr(:index, 1).flash
  8. browser.table.row(:index, 2).flash
  9.  
  10. #Get the 3rd row down from the row containing the text 'Equipment'
  11. starting_row_index = browser.table.rows.to_a.index{ |row| row.text =~ /Equipment/ }
  12. offset = 3
  13. row = browser.table.row(:index, starting_row_index + offset)
  14. puts row.text
  15. # => CAT03 ...
  16.  
  17. #Get the 3rd row down from the row containing a cell with yellow background colour
  18. starting_row_index = browser.table.rows.to_a.index{ |row| row.td(:css => "td[bgcolor=yellow]").present? }
  19. offset = 3
  20. row = browser.table.row(:index, starting_row_index + offset)
  21. puts row.text
  22. # => ETS36401 ...
  23.  
  24. #Output the first column text of each row after the row containing a cell with yellow background colour
  25. starting_row_index = browser.table.rows.to_a.index{ |row| row.td(:css => "td[bgcolor=yellow]").present? }
  26. (starting_row_index + 1).upto(browser.table.rows.length - 1){ |x| puts browser.table[x][0].text }
  27. # => CAT03, CAT08, ..., INTEGRA10, INTEGRA11
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement