Forum Discussion
cdeng
10 years agoOccasional Contributor
Issues on working with table Cell
I came across with several problems on it.
(1) I am able to locate the cell but not able to click.
(2) On object spy I was able to see the className property but the className became empty during execution on the TC - thus showing on the debug, object evaluation, the className is empty but I can see it on with object spy.
I am using TC 10.40.2015.7 and I have a table in screenshot 1(before click), screeshot(2,3,4) are by different click actions and I want to verify. I need to check the state of the columes of Yes and the No. Before click and I found the only property change before click and after click is the className. Before click, both of the Yes/No has the the property for the className: selectButton rosYN and the property for the className: selectButton rosYN selected.
function verifyChildSystem() {
var page = Sys.Browser(startstop.readBroswerFromIni()).Page("*");
var tblChildSystem = page.Find('idStr','childsystem',100);
if (tblChildSystem.Exists) {
//Goes through the rows and cells of the table
for (var i = 2; i < tblChildSystem.rows.length; i++) {
Log.AppendFolder("Row " + i);
for (var j = 0; j < tblChildSystem.rows.item(i).cells.length; j++)
//j = 1/2 (yes/no), j = 4/5 (yes/no), j = 7/8 (yes/no)
if (aqString.GetLength((tblChildSystem.rows.item(i).cells.item(j).innerText))>1){
Log.Message("Cell " + j + ": " + tblChildSystem.rows.item(i).cells.item(j).innerText);
var btn_InnerText = tblChildSystem.rows.item(i).cells.item(j).innerText;
var btn_IdStr = tblChildSystem.rows.item(i).cells.item(j).idStr;
//There is not any Yes/No selected
// if (j == 1 || j ==2 || j==4 || j ==5 || j== 7 || j==8)
if (j == 1 || j==4 || j== 7) {
var btnItem = tblChildSystem.rows.item(i).cells.item(j);
var btnItemStr = tblChildSystem.rows.item(i).cells.item(j).idStr;
bResult=aqObject.CheckProperty(btnItem, "className", cmpEqual, 'selectButton rosYN');
}
else if (j ==2 || j ==5 || j==8) {
var btnItem = tblChildSystem.rows.item(i).cells.item(j);
btnItem = btnItem.Find('ContentText','No',100);
bResult=aqObject.CheckProperty(btnItem, "className", cmpEqual, 'selectButton rosYN');
}
}
}
}
}
function markShildSystem(iconBS,selectYesNo) {
var page = Sys.Browser(startstop.readBroswerFromIni()).Page("*");
var tblChildSystem = page.Find('ObjectIdentifier','childsystem',100);
var iconInnerText;
if (tblChildSystem.Exists) {
//Goes through the rows and cells of the table
for (var i = 2; i < tblChildSystem.rows.length; i++) {
for (var j = 0; j < tblChildSystem.rows.item(i).cells.length; j++) {
if (aqString.GetLength((tblChildSystem.rows.item(i).cells.item(j).innerText))>1){
Log.Message("Cell " + j + ": " + tblChildSystem.rows.item(i).cells.item(j).innerText);
iconInnerText = tblChildSystem.rows.item(i).cells.item(j).innerText;
if (aqString.StrMatches(iconBS, iconInnerText)) { //item found
if (selectYesNo == 'Yes') {
var iconYes = tblChildSystem.rows.item(i).cells.item(j+1) ;
iconYes.Click();
}
else { //No
var clickNo=tblChildSystem.rows.item(i).cells.item(j+2);
clickNO.Click();
}
//if the ChildSystem found then exit both of the loops
j = tblChildSystem.rows.item(i).cells.length + 1;
i = tblChildSystem.rows.length + 1;
break;
}
}
}
}
}
}
function unittest(){
verifyChildSystem();
markShildSystem('Chills','Yes');
}
Related Content
Recent Discussions
- 20 hours agodhundley