在RFT中如何获取JTable中的所有数据?

来源:互联网 发布:淘宝店铺在哪投诉 编辑:程序博客网 时间:2024/05/04 01:41

 

 

在RFT中如何获取JTable中的所有数据?

 

public void testMain(Object[]args)

{

 

//Start Classics Java Application

startApp("ClassicsJavaA");

 

//Navigate to Existing Order Grid

jmb().click(atPath("Order"));

jmb().click(atPath("Order->ViewExisting Order Status..."));

 

// Frame: View Order Status

nameComboB().click();

nameComboB().click(atText("ClaireStratus"));

ok().click();

 

// Frame: View Existing Orders

existingTable().click(atPoint(172,92));

 

//Get the data for the table

ITestDataTableorderTable = (ITestDataTable)existingTable().getTestData("contents");

 

//Display the available data types for the grid, totalrows and columns.

System.out.println ("AvailableData Types: " + existingTable().getTestDataTypes());

System.out.println ("Total Rows intable : " + orderTable.getRowCount());

System.out.println ("Total Cols intable : " + orderTable.getColumnCount());

 

          // Cycle through all rows

          for (int row=0; row <orderTable.getRowCount();++row)

          {

              // Cycle through all columns

              for (int col=0; col <orderTable.getColumnCount();++col)

              {

                  // Print out valuesof cells at (row,col) coordinates

                  System.out.println ("Row " + row + ", " + orderTable.getColumnHeader(col) + ": " +orderTable.getCell(row,col) );

                    }

            }

// Close the frame

close().click();

 

// Frame: ClassicsCD

classicsJava(ANY,MAY_EXIT).close();

}

}

 

 

控制台输出:

Available Data Types: {contents=表内容, visible contents=可见表内容,selected=选中的表单元格, visible selected=选定可见表单元格}

Total Rows in table : 1

Total Cols in table : 7

Row 0, ORDER ID: 7

Row 0, ORDER DATE: 3/11/98

Row 0, STATUS: Order Initiated

Row 0, COMPOSER: Bach

Row 0, COMPOSITION: Brandenburg Concertos Nos. 1& 3

Row 0, QUANTITY: 5

Row 0, TOTAL: 84.9500

 

 

 

 

 

原创粉丝点击