Hi All,
I am using appium flutter driver with wdio and there is one element in heirachy from which I want to extract text for the price and verify it.
Below is the dev code for the same:
return Semantics(
label: text.stripHtml,
child: Wrap(crossAxisAlignment: WrapCrossAlignment.center, children: widgets,),
key: Key(“catalog_product_card_price”)
);
Below is the script code to get text from it:
for (const catalogItem of menClothingSubCatalogMap[subCatalog]) {
log.info(Navigating to ${catalogItem} ${
catalog_product_#${index}}
);
await driver.execute(‘flutter:scrollIntoView’, find.byValueKey(catalog_product_#${index}
), { alignment: 0.1 });
await driver.execute(‘flutter:waitFor’, find.byValueKey(catalog_product_#${index}
));
const catalogPrice = find.descendant({
of: find.byValueKey(catalog_product_#${index}
),
matching: find.bySemanticsLabel(‘catalog_product_card_price’),
});
console.log(‘****************’);
console.log(catalogPrice);const price = await driver.getElementText(catalogPrice); const regex = /^[¢£$kc¥€]{1}\d{1,}(\.\d{1,3})?$/ig; const results = regex.test(price); expect(results).to.be.true; index++; }
In my case getElementText() is not working using above approach.
Can someone pls tell me what I am missing at my end?
Thanks
Below is the console log for the value of catalogPrice
Below is the error I am facing using getElementText()