NativeScript/nativescript-dev-appium

Get Text from alert message

gkvappium opened this issue · 2 comments

I want to retrieve the text from an alert message. On android there is no problem. But on IOS, can't really get the text. I do not want to do a findElementByText and pass the entire value since there are some localization stuff involved.

There is a method in selenium ,something like driver.switchTo().alert().getText(). But couldn't figure out a way to use this method.

@SvetoslavTsenov , do you have any idea as to how to use it along with the plugin?

If I have to be honest I haven't try it but probably you could try to locate the alert by xpath and then use getText()

Hi @SvetoslavTsenov ,

Found a solution. There is method in wd to get the text from the alert (driver.driver.alertText() ). Gives the alert title as well as the alert message. Since i was looking into localization, wanted to use a generic method that can work across different languages (Using an npm pkg called franc-min for localization testing). Thanks for looking into this though