In my automation code,I have two javascript file having different class and some getters. I get some input from user and depending on that input, i create the name of getter during runtime and access the getter of both classes.
I am able to access the getter of same class but i am facing issue while accessing the getter of different class.
const AutomationClass2 = require('./AutomationClass2.js')
class AutomationClass1 extends Page {
get GeneralTile() {
return browser.isAndroid ? $(~abc) :$(~abc)
}
navigateLandingPage(page, tab) {
if (tab == "tab") {
//page=zones, tab=tab
var lObj = page+ "Tab" //facing issue while accessing the getter of "AutomationClass2"
AutomationClass2.lObj.waitForExist(20000) //facing issue
AutomationClass2.lObj.click() //facing issue
}
else if (tab == "zone") {
//page=General
var lObj = page+ "Tile" //GeneralTile
this[lObj].waitForExist(20000) //working fine
this[lObj].click() //working fine
}
}
}
AutomationClass2 looks like
class SettingGeneral extends Page {
/**
* define elements
*/
get zonesTab() {
console.log("in zones tab getter ")
const elem = browser.isAndroid ? $('~TabZones') : $('~TabZones')
return elem
}
}
In first if i.e "if (tab == "tab") {" I am not able to access the getter "zonesTab" of class "AutomationClass2" Thanks in Advance,It will be great help