Hi All,
I want to get text from the element which is like this:
Current code:
export async function getElementWithXPath(xPathforAndroidElem: string, xPathforIOSElem: string) {
let button = {};
if (platformName === ‘android’) {
button = await driver.findElement(‘xpath’, xPathforAndroidElem);
} else if (platformName === ‘ios’) {
button = await driver.findElement(‘xpath’, xPathforIOSElem);
} else {
throw new Error(exceptionConstants[‘invalidPlatform’]);
}
return button;
}
const button1 = await getElementWithXPath(
//*[contains(@content-desc,'Fastest delivery')]
,//*[contains(@name, 'Fastest delivery')]
);
const text = await driver.getElementText(button1[‘ELEMENT’]);
log.info(Text is ${text}
);
Output:
Here text is coming as blank.
Can someone tell me please what I am missing here?