0

Using Marathon to test a java application, I have a handful of rows and I want to commit some operations on a specific row that has certain text in one of its fields.

How would I go about searching for it and then selecting it to use it in Marathon or JRuby?

For example, I want to find the text "HERE" in a row, right click that row, and click one of the options provided.

Zein
  • 67
  • 1
  • 8

1 Answers1

0

There are two ways you can do this.

  1. You can fall back to WebDriver interfaces and use find_elements.

    table = get_component('oscarTable')
    cells = table.find_elements(:css, '.::all-cells[text="102 Dalmatians"]')
    cells.each { |c| puts c.text }
    
  2. Use text property and access the cell directly

    cell = get_component('oscarTable', { :text => '102 Dalmatians' })
    puts cell.text
    

In (2) you can use select instead of get_component to set the value of the cell (if the cell is editable etc.)

Dakshinamurthy Karra
  • 5,353
  • 1
  • 17
  • 28
  • How do I know what parameter to send into get_component? There are multiple tables on screen so I'm not quite sure how to differentiate. When I return all elements using :css, "*", it gives me "TrueClass: 0x42590234". Not that exact number, but that format. – Zein Aug 07 '18 at 13:04
  • Best is to record something using the table and use the name generated by Marathon. – Dakshinamurthy Karra Aug 07 '18 at 13:07
  • That worked. With your first code, it did print the text as well as "#' I tried to just do rightclick(cells) and it threw a type error. How would I utilize the obtained element? – Zein Aug 07 '18 at 13:17