Aliases, NameMapping, and Sys objects are supported in Script Extensions so FindChild, being a method off one of those objects, is supported.
What I'm thinking is the problem is that you are using native TestComplete methods and objects within those intial variable declarations. At those points, the script extension engine is not utilizing TestComplete but initializing the variables within the native JScript environment. Sys.Browser, etc., are not recognized there. I've run into various problems with this myself.
Another problem is that you added the "NameSpace" to your runtime object. That means the object is referenced as
Navigation.Menu.menuGroups()
I'm not entirely sure why your call worked as it did with autocomplete with that NameSpace in place.
You need to wrap your intialization in some other functions to be able to allow the testcomplete engines to initialize.
var page;
var mainMenu;
function getpage() {
page = Sys.Browser("iexplore").Page("https://*.imedconsent.com/*");
return page;
}
function getmainMenu() {
mainMenu = getpage().FindChild("idStr", "regexp: (mainMenuInner)|(navMenuInner)", 10);
return mainMenu;
}
function swceProcPatient(){
let menuProcPatient = getmainMenu().FindChild("contentText", "Process Patients", 20);
menuProcPatient.Click();
}
function swceReports(){
let menuReoports = getmainMenu().FindChild("contentText", "Reports", 20);
menuReoports.Click();
}
function swceGroups(){
let menuGroups = getmainMenu().FindChild("contentText", "Groups", 20);
menuGroups.Click();
}
function fodSelectPatients(){
let menuSelectPatients = getmainMenu().FindChild("contentText", "Select Patients", 20);
menuSelectPatients.Click();
}
function swceHome(){
let menuHome = getmainMenu().FindChild("contentText", "Home", 20);
menuHome.Click();
}
function swceLogOut(){
let menuLogout = getmainMenu().FindChild("contentText", "Logout", 5);
menuLogout.Click();
}