Forum Discussion
Mia
12 years agoContributor
I guess the row exists... I assume, that if I work only with those two rows on the screenshot, TestComplete generates its adresses well.
When I recorded the test, all I did was clicking into the first cell and I hit those keys: "50 + [Enter]". But TestComplete divided the number into 5 and 50. And since the "5" is inserted, the cell adress is changed somehow. IMHO, that's why it does not work.
If I modify it like this, it is working. But this approach seems to be very unreliable, because the adress to the particular cell or row is always different - depending on the number I insert.
function GridTest()
{
TestedApps.TestComplete.Run();
Aliases.TestComplete2.HwndSource_MainWindow.MainWindow.StackPanel.Grid.DataGridRow2.Datagridcell23.Keys("50");
}
Anyway, I treid to use the approach number 1. I like it more than working with particular cell/row and it would be really great if it worked.
But both ways I tried are not working properly.
1)This works until use e.g. ClickCell(1, "Id"); I always get and error, that the control item not found. And it is there.
function GridTest1()
{
var w;
w = Sys.Process("TestComplete", 2).WPFObject("HwndSource: MainWindow", "MainWindow").WPFObject("MainWindow", "MainWindow", 1).WPFObject("StackPanel", "", 1).WPFObject("Grid");
w.DblClickCell(0, "Id");
//w.ClickCell(0, "Id");
Sys.Keys('40'+'[Enter]');
}
2) This code is partially working, the value is inserted somewhere into the data source, but I cannot see it in the UI. To see it, I have to click e.g. on the headers, or make some another action in the grid. I tried to end the code with w.Refresh(), but it didn't help. And I couldn't find any other function for inserting value.
function GridTest2()
{
var w;
w = Sys.Process("TestComplete", 2).WPFObject("HwndSource: MainWindow", "MainWindow").WPFObject("MainWindow", "MainWindow", 1).WPFObject("StackPanel", "", 1).WPFObject("Grid");
w.ClickCell(0, "Id");
w.wValue(0, "ID") = "8888";
}
When I recorded the test, all I did was clicking into the first cell and I hit those keys: "50 + [Enter]". But TestComplete divided the number into 5 and 50. And since the "5" is inserted, the cell adress is changed somehow. IMHO, that's why it does not work.
If I modify it like this, it is working. But this approach seems to be very unreliable, because the adress to the particular cell or row is always different - depending on the number I insert.
function GridTest()
{
TestedApps.TestComplete.Run();
Aliases.TestComplete2.HwndSource_MainWindow.MainWindow.StackPanel.Grid.DataGridRow2.Datagridcell23.Keys("50");
}
Anyway, I treid to use the approach number 1. I like it more than working with particular cell/row and it would be really great if it worked.
But both ways I tried are not working properly.
1)This works until use e.g. ClickCell(1, "Id"); I always get and error, that the control item not found. And it is there.
function GridTest1()
{
var w;
w = Sys.Process("TestComplete", 2).WPFObject("HwndSource: MainWindow", "MainWindow").WPFObject("MainWindow", "MainWindow", 1).WPFObject("StackPanel", "", 1).WPFObject("Grid");
w.DblClickCell(0, "Id");
//w.ClickCell(0, "Id");
Sys.Keys('40'+'[Enter]');
}
2) This code is partially working, the value is inserted somewhere into the data source, but I cannot see it in the UI. To see it, I have to click e.g. on the headers, or make some another action in the grid. I tried to end the code with w.Refresh(), but it didn't help. And I couldn't find any other function for inserting value.
function GridTest2()
{
var w;
w = Sys.Process("TestComplete", 2).WPFObject("HwndSource: MainWindow", "MainWindow").WPFObject("MainWindow", "MainWindow", 1).WPFObject("StackPanel", "", 1).WPFObject("Grid");
w.ClickCell(0, "Id");
w.wValue(0, "ID") = "8888";
}