1

I'm using marathonITE testing tool to automate testing of a java swing application.

In one of the windows i have a JTable with 6 columns and N number of rows. Two columns of that table are checkbox type columns.

My requirement is to write the automation script to tick the check box when the row and column is given.

select('table', 'true', '[row=1][column=0]')

I tried this line but it directs the script to

class Fixture:


def teardown(self):
    '''Marathon executes this method at the end of test script.'''
    pass

which then stops the process.

Is there a way to tick the checkbox within a table when column and row is given?

direndd
  • 642
  • 2
  • 16
  • 47
  • I have never used the tool but I would guess that "select" is used to give a cell focus on the table (ie, the cell with the border). I suspect what your really want to do is "edit" the cell. So the question is how would you change the data of any cell in the table? I would guess you then just set the data to Boolean.TRUE for that cell. – camickr Sep 01 '15 at 15:55

2 Answers2

0

I found a workaround for this problem. In the first part i traverse through the table and checks whether the test value is equal to each of those cell values. In the second part i use keystrokes to traverse to that particular row and column and use space and enter keystrokes to tick the check box.

Note that this method works only for checking a single check box. For multiple check boxes will have to traverse back using key strokes and re do the keystroke traversing.

#1st Part

            textValue = "Test Value"
            deplTable = get_component('table')
            no_of_columns = deplTable.getColumnCount()
            no_of_rows = deplTable.getRowCount()

            for col in range (no_of_columns):
                if ( col == 1 or col == 4 ):
                    for row in range (no_of_rows):

                        if ( deplTable.getValueAt( row ,col) == textValue ):
                            print 'Found at row:',row,' col:',col
#2nd Part
                            for x in range (row+1) :
                                keystroke('table', 'Down')
                            keystroke('table', 'Left')
                            if ( col > 1 ):
                                for  y in range (col-1) :
                                    keystroke('table', 'Right')

                            keystroke('table', 'Space')
                            keystroke('table', 'Enter')
direndd
  • 642
  • 2
  • 16
  • 47
0

Write your code in this way:

select('table', 'true', '{1,0}')

This is working for me.

John Moutafis
  • 22,254
  • 11
  • 68
  • 112