Forum Discussion
cdeng
10 years agoOccasional Contributor
Hear is my solution to resolved my issue. Thanks!
//Author: Carol D.
//Date: November 2014
//Purpose: Verify the ROS Child System UI
//PM Reports > Custom Reports, Create Template, View Report, Cancel
function verifyChildSystem() {
var page = Sys.Browser("Firefox").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++) {
for (var j = 0; j < tblChildSystem.rows.item(i).cells.length; j++)
if (aqString.GetLength((tblChildSystem.rows.item(i).cells.item(j).innerText))>1){
var btn_InnerText = tblChildSystem.rows.item(i).cells.item(j).innerText;
//The default status: there is not any Yes/No selected
if (j == 1 || j ==2 || j==4 || j ==5 || j== 7 || j==8){
var btn_Name = tblChildSystem.cell(i,j).Panel("*");
bResult=aqObject.CheckProperty(btn_Name, "className", cmpEqual, 'selectButton rosYN');
}
}
}
}
}
function markShildSystem(iconBS,selectYesNo) {
var page = Sys.Browser("Firefox").Page("*");
var tblChildSystem = page.Find('ObjectIdentifier','childsystem',100);
// LogAppStructure(tblChildSystem);
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.cell(i,j+1).Panel('*') ;
iconYes.Click();
//iconYes.Child(0).Panel("*").Click();
bResult=aqObject.CheckProperty(iconYes, "className", cmpEqual, 'selectButton rosYN selected');
}
else { //No
var iconNo=tblChildSystem.cell(i,j+2).Panel('*') ;
iconNo.Click();
bResult=aqObject.CheckProperty(iconNo, "className", cmpEqual, 'selectButton rosYN selected');
}
//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');
markShildSystem('Fever','No');
}
//Author: Carol D.
//Date: November 2014
//Purpose: Verify the ROS Child System UI
//PM Reports > Custom Reports, Create Template, View Report, Cancel
function verifyChildSystem() {
var page = Sys.Browser("Firefox").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++) {
for (var j = 0; j < tblChildSystem.rows.item(i).cells.length; j++)
if (aqString.GetLength((tblChildSystem.rows.item(i).cells.item(j).innerText))>1){
var btn_InnerText = tblChildSystem.rows.item(i).cells.item(j).innerText;
//The default status: there is not any Yes/No selected
if (j == 1 || j ==2 || j==4 || j ==5 || j== 7 || j==8){
var btn_Name = tblChildSystem.cell(i,j).Panel("*");
bResult=aqObject.CheckProperty(btn_Name, "className", cmpEqual, 'selectButton rosYN');
}
}
}
}
}
function markShildSystem(iconBS,selectYesNo) {
var page = Sys.Browser("Firefox").Page("*");
var tblChildSystem = page.Find('ObjectIdentifier','childsystem',100);
// LogAppStructure(tblChildSystem);
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.cell(i,j+1).Panel('*') ;
iconYes.Click();
//iconYes.Child(0).Panel("*").Click();
bResult=aqObject.CheckProperty(iconYes, "className", cmpEqual, 'selectButton rosYN selected');
}
else { //No
var iconNo=tblChildSystem.cell(i,j+2).Panel('*') ;
iconNo.Click();
bResult=aqObject.CheckProperty(iconNo, "className", cmpEqual, 'selectButton rosYN selected');
}
//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');
markShildSystem('Fever','No');
}
Related Content
- 12 months agosanket2799
- 8 months agonastester
- 10 months agomgormsen
- 3 years agoMichal_Ignaczak
- 9 months agoLuukdb