Forum Discussion
AlexeyKolosov
Staff
14 years agoHi Kish,
Your script simply clicks the first row in which the "View" link is present (it doesn't even click the link, it clicks the entire row). Here is an improved version of the script:
I cannot test this code, because I have no access to your application, but it should work.
Your script simply clicks the first row in which the "View" link is present (it doesn't even click the link, it clicks the entire row). Here is an improved version of the script:
function CancelInvoice()
{
var invoicetable = NameMapping.Sys.IEXPLORE.pageCustomerrenewaldetails.panelMsDlgcontent_2.panelMsDlgborder.panelMsDlgframecontainer.frameDlgframecc7178db6cb84d9880b.formAspnetform.panelS4Workspace.panelS4Bodycontainer.panelS4Mainarea.panelMsoContenttable.panelS4Ba.panelMsBodyareacell.panelCtl00MsoContentdiv.panelContainer.panelOrderdetailszone.table.cellMsozonecellWebpartctl00MG65f.tableS4Wptoptable.cell.panelWebpartctl00MG65f23335Bacc4.panelCtl00MG65f23335Bacc48199973.panelCtl00MG65f23335Bacc48199973.panelCtl00MG65f23335Bacc48199973.panelCtl00MG65f23335Bacc48199973.panelCtl00MG65f23335Bacc48199973.panelCtl00MG65f23335Bacc48199973.tableCtl00MG65f23335Bacc48199973;
for(i=0; i<invoicetable.rows.length; i++)
{
var isClickViewLinkInThisRow = false;
for (j = 0; j < invoicetable.rows.item(i).cells.length; j++)
{
var cellText = invoicetable.rows.item(i).cells(j).innerText;
Log.Message("Cell " + j + ": " + cellText);
if (aqString.Compare(cellText, "Invoice Pending", false) == 0)
{
isClickViewLinkInThisRow = true;
}
if(aqString.Compare(cellText, "View", false) == 0 && isClickViewLinkInThisRow)
{
invoicetable.rows.item(i).cells(j).Click();
}
}
}
}
I cannot test this code, because I have no access to your application, but it should work.