Objects cannot be found
Posted: Fri Apr 25, 2014 9:28 pm
I am setting up automation on this web page. There are more than 50 elements on the page so some of the data is not visible on the web page. I use Ranorex spy to see the elements and there are many elements that are not visible and set to visible.
I feel like I shouldnt have to use EnsureVisible because it scrolls through the page which takes a long time.
So here is my code.
DivGrid = document.FindSingle("/dom//div[#'gbox_grid1']"); //root of grid
TBodyTag tbody = DivGrid.FindSingle("/dom//table[#'grid1']/tbody");
subTotals = tbody.Find<TrTag>(".//tr[@class='ui-widget-content jqgrow ui-row-ltr']");
for(int i = 0; i< subTotals.Count; i++)
{
//subTotals.EnsureVisible(); <- so when this is not commented out I get the elements but of I commented it out I get nothing.
tdSubTotal = subTotals.Find<TdTag>(".//td[@valid ='true']"); <- if I remove the visiblity = true then I get every element within the tag which I dont need.
//Report.Info(i +" : "+ tdSubTotal[tdSubTotal.Count - placeCount].InnerText.ToString());
subTot = subTot + convertToNum(tdSubTotal[tdSubTotal.Count - placeCount].InnerText.ToString());
}
I feel like I shouldnt have to use EnsureVisible because it scrolls through the page which takes a long time.
So here is my code.
DivGrid = document.FindSingle("/dom//div[#'gbox_grid1']"); //root of grid
TBodyTag tbody = DivGrid.FindSingle("/dom//table[#'grid1']/tbody");
subTotals = tbody.Find<TrTag>(".//tr[@class='ui-widget-content jqgrow ui-row-ltr']");
for(int i = 0; i< subTotals.Count; i++)
{
//subTotals.EnsureVisible(); <- so when this is not commented out I get the elements but of I commented it out I get nothing.
tdSubTotal = subTotals.Find<TdTag>(".//td[@valid ='true']"); <- if I remove the visiblity = true then I get every element within the tag which I dont need.
//Report.Info(i +" : "+ tdSubTotal[tdSubTotal.Count - placeCount].InnerText.ToString());
subTot = subTot + convertToNum(tdSubTotal[tdSubTotal.Count - placeCount].InnerText.ToString());
}