I'm trying to click on a child checkbox which is in a tablecolumn (has fx:id) and tableview (has fx:id). The parent checkbox has fx:id which is in the same tablecolumn of child checkbox. Here is my code:
public void clickChild(String id, String yd) throws Exception {
TableView tableView= (TableView)(fxer.getAt( "#"+id ));
Tablecolumn colum = (TableColumn)(fxer.getAt( "#"+yd ));
//assertNotNull( "Table View cannot be found", tableView);
tableView.getSelectionModel().select(1, colum);
Thread.sleep( 100 );
FXApp.initializeIfStageExists();
if (FXApp.isInitialized()) {
fxer = FXer.getUserWith( FXApp.getScene().getRoot() );
} else {
throw new RuntimeException( "Could not find a JavaFX Stage" );
}
fxer.waitForFxEvents();
}
I know my code has problems but I'm really not sure how to proceed. I already did lots of online research but unable to find a solution how should I proceed and which methods should I use. Output is:
error: incompatible types: Node cannot be converted to TableColumn
I know I cannot cast Node to TableColumn but I don't know how can I do to click on the child checkbox.
Also tried this code which clicks on the Parent checkbox:
public void clickChild(String id, String yd) throws Exception {
fxer.clickOn(fxer.getAt( "#"+yd ));//id of table column
TableView tableView = (TableView)(fxer.getAt("#"+id));//id of table view
CheckBox cb = (CheckBox)(tableView.getSelectionModel().getSelectedItem());
cb.setSelected(true);
Thread.sleep( 100 );
FXApp.initializeIfStageExists();
if (FXApp.isInitialized()) {
fxer = FXer.getUserWith( FXApp.getScene().getRoot() );
} else {
throw new RuntimeException( "Could not find a JavaFX Stage" );
}
fxer.waitForFxEvents();
}
Aucun commentaire:
Enregistrer un commentaire