microsoft / WinAppDriver

Windows Application Driver
MIT License
3.66k stars 1.4k forks source link

WinAppDriver always fetches empty string value for the price Text field on "Store Purchase App" page #191

Open Korop opened 7 years ago

Korop commented 7 years ago

In my payment Win10 UI test(with a sandbox user for test payments) during purchasing procedure from the Store I check the product price text which should be "$0.00" to confirm that the purchase is a test one. See attachments. Run with: WinAppDriver 1.0.9.0 , appium 1.6.5 beta. There is issue with the text(element properties) caching on the driver side. When the test fetches the text element from "PriceContainer" group it is always "" (empty). But visually the text "$0.00" exists. See screenshot. Winappdriver`s findElement command returns the real text only if I investigate manually the field with 'inspect' tool from Windows 10 SDK. Suppose this action impacts on an internal driver cache update.

Name:   "https://www.microsoft.com/webblend/getClientView?clientType=DeviceStoreClient&version=2"
ControlType:    UIA_PaneControlTypeId (0xC371)
LocalizedControlType:   "pane"

I tried to fetch the text element with different selector type by id and xpath without success.

log.info("Windows Store: tap 'Get' button");
WebElement getBtn = new WebDriverWait(ad(), 10, 500).until(ExpectedConditions.elementToBeClickable(MobileBy.AccessibilityId("confirmButton")));
String productText = ad().findElement(MobileBy.AccessibilityId("ProductContainer")).findElement(MobileBy.tagName("Text")).getText();
String priceText2 = ad().findElement(MobileBy.AccessibilityId("PriceContainer")).findElement(MobileBy.tagName("Text")).getText();
String priceText = ad().findElement(MobileBy.xpath("//*[@AutomationId='PriceContainer']/*[@LocalizedControlType='text']")).getText();
log.info(String.format("Windows Store: product=%1$s, price=%2$s", productText, priceText));
Objects.requireNonNull(productText);
getBtn.click();

//new WebDriverWait(ad(), 10, 1000).until(ExpectedConditions.invisibilityOfElementLocated(MobileBy.name("Store Purchase App")));
new WebDriverWait(ad(), 10, 1000).until(ExpectedConditions.invisibilityOfElementLocated(MobileBy.AccessibilityId("confirmButton")));
Korop commented 7 years ago
screen shot - dailog strycture - 2017-05-23 at 1 02 33 pm screen shot 2017-05-23 at 1 38 17 pm
Korop commented 7 years ago

after inspect the element with inspector:

screen shot - after inspect reviewed -2017-05-23 at 1 00 39 pm
Korop commented 7 years ago
screen shot 2017-05-23 at 1 01 58 pm
Korop commented 7 years ago

can relate with #210