Forum Discussion
Hi,
Thank you a lot for the link provided.
Fantastic example, directly from the product provider, of how the product can be created with the absolute ignorance of automated testing. Bookmarked.
The problem with all Angular controls that I've seen so far is that (by default?) they provide no unique and stable identifiers. The only entities that can be used to address UI elements is usually class name and visible text. I am pretty sure it is needless to say how unreliable this is.
Anyway, assuming that there is only one table on the page with the 'grid_container' identifier, personally I would do it like this:
-- search for the table container (tableContainer = page.FindChild(['ObjectType', 'ObjectIdentifier'], ['Panel', 'grid_container'], 10));
-- Using table container as the root, search for all 'uiGrid_0007_cell' elements that correspond to the data cells of the first column (arCells = tableContainer.FindAllChildren(['ObjectType', 'ObjectIdentifier'], ['Panel', 'uiGrid_0007_cell'], 10).toArray() ) (Note: the array will be in reverse order, i.e. the first array element will correspond to the last column cell - this is specific of how TestComplete's .FindAllChildren() method works);
-- Iterate through the returned array and get the value of the contentText property to get first column cell values.
Thank you Alex. It was really good approach .
I executed the following code , please verify and I am getting JScript runtime error 'page' is undefined . Please correct me where I am going wrong. I attach screen shot
function VerifyGridValue(textValue)
{
Sys.Browser("*").Page("*").Wait("10000");
tableContainer = page.FindChild(['ObjectType', 'ObjectIdentifier'], ['Panel', 'grid_container'], 10);
var Cells = tableContainer.FindAllChildren(['ObjectType', 'ObjectIdentifier'], ['Panel', 'uiGrid_0007_cell'], 10).toArray() ;
console.log(Cells);
}
- AlexKaras7 years agoChampion Level 3
In addition to the note by baxatob:
.FindAllChildren() returns an array, thus while
console.log(Cells);
will work if executed from command line via cscript engine, the same line will fail in TestComplete as there is no console object.
You will need to either convert the array to string or iterate through it. Code example can be found, for example, here: http://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/findallchildren-method.html
- baxatob7 years agoCommunity Hero
You should define page variable.
page = Sys.Browser("*").Page("*")
Related Content
- 3 years ago