How to read otp number from the notification panel in the android by appium automation testing

Viewed 18

{

       ((AndroidDriver) driver).openNotifications(); 

click(expandNotificationPanel); AndroidElement otpElement=(AndroidElement)driver.findElementByXPath("//[contains(@text,"Verification code:")]"); String OTPmessage = otpElement.getText(); String OTP = OTPmessage.substring(OTPmessage.lastIndexOf(":")+1); ((AndroidDriver) driver).pressKey(new KeyEvent(AndroidKey.BACK)); }

0 Answers
Related