How To Handle Toast Generate In Android Device While Automating An App Using Appium?
I am trying to automate an android app using Appium and Webdriver. When i give invalid credentials to login into the app a toast appears, i want to assert the text of this toast.Al
Solution 1:
Yes it is possible but only using uiautomator2, just pass the argument in the capability and use the below code:
DesiredCapabilities caps = DesiredCapabilities.android();
caps.setCapability("automationName", "uiautomator2");
caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
WebElement toastView = _ForgetPasswordDriver.findElement(By.xpath("//android.widget.Toast[1]"));
String actual_toast_msg = toastView.getAttribute("name").trim();
Post a Comment for "How To Handle Toast Generate In Android Device While Automating An App Using Appium?"