Mia
10 years agoContributor
Working with WPF DataGrid - some objects cannot be found
Hi,
I am trying to record easy test with WPF DataGrid. Just to fill a content of one cell. TC9 generated following script.
function DataGrid()
{
TestedApps.TestComplete.Run();
Aliases.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.Grid.ClickNewRowCellXY("Id", 104, 9);
Aliases.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.Grid.DataGridRow2.DataGridCell.Keys("5");
Aliases.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.Grid.DataGridRow2.DataGridCell2.TextBox.SetText("50");
Aliases.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.Grid.DataGridRow2.DataGridCell2.TextBox.Keys("[Enter]");
}
It works until it comes to third row. I always get error message that it cannot find the TextBox. But when I use the Object Spy or Object browser, it is there. Also in the NameMapping tree veiw I have everything mapped, including the TextBox object.
I tried to read some smartbear articles and some threads here on forum, but I hit the dead end and I just cannot figure it out.
The error message.
I am trying to record easy test with WPF DataGrid. Just to fill a content of one cell. TC9 generated following script.
function DataGrid()
{
TestedApps.TestComplete.Run();
Aliases.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.Grid.ClickNewRowCellXY("Id", 104, 9);
Aliases.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.Grid.DataGridRow2.DataGridCell.Keys("5");
Aliases.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.Grid.DataGridRow2.DataGridCell2.TextBox.SetText("50");
Aliases.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.Grid.DataGridRow2.DataGridCell2.TextBox.Keys("[Enter]");
}
It works until it comes to third row. I always get error message that it cannot find the TextBox. But when I use the Object Spy or Object browser, it is there. Also in the NameMapping tree veiw I have everything mapped, including the TextBox object.
I tried to read some smartbear articles and some threads here on forum, but I hit the dead end and I just cannot figure it out.
The error message.
" An error occurred while accessing the "SetText" method or property of the "TextBox" object.
The object or one of its parent objects was not found.
Object Whose Method or Property Was Accessed
Alias: | Aliases.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.Grid.DataGridRow2.DataGridCell2.TextBox |
Name mapping item: | NameMapping.Sys.TestComplete.HwndSource_MainWindow.MainWindow.StackPanel.Grid.DataGridRow2.DataGridCell2.TextBox |
Object That Was Not Found
Click the link above to view and configure mapping settings for the missing object.
Learn about possible causes of the error "