Underorder list is getting null when try to run from TestComplete Execution plan.
I have an application where I click on the 'Create New button and then it populates the Unordered list.
I am calling the script routine which contains code for the above actions in multiple keywords Test. When I am running these tests individually, the list is populating as expected but when I am running the keyword test from the execution plan, at first Keyword Test run the list is not null but at subsequent runs, the undordered list is getting null.
Here is my code
function ClickCreateNewAuth(HP){
try{
var btnCreateNew = Wait.findObject("//button[contains(text(),'Create New')]");
btnCreateNew.Click();
Delay(500);
var HealthPlanList = null;
HealthPlanList = page.FindElements("//div[@class='dropdown dropdown-custom mt-15 open']//ul[@class='dropdown-menu pull-right']/li/a");
if (HealthPlanList.length <= 0 || HealthPlanList === null)
{
navigateToHomePage()
GoToPAS()
btnCreateNew.Click();
Delay(10000);
HealthPlanList = page.FindElements("//div[@class='dropdown dropdown-custom mt-15 open']//ul[@class='dropdown-menu pull-right']/li/a");
}
if (HealthPlanList.length > 0)
{
for (var i = 0; i < HealthPlanList.length; i++)
{
//Log.Message(HealthPlans[i].innerText);
var value = HealthPlanList[i].innerText;
if(HP == value)
{
HealthPlanList[i].Click();
break;
}
}
}
else{
Log.Error('Health Plan List is null or '+HealthPlanList.length);
}
}