nativescript-dev-appium icon indicating copy to clipboard operation
nativescript-dev-appium copied to clipboard

Get Text from alert message

Open gkvappium opened this issue 5 years ago • 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?

gkvappium avatar May 14 '19 14:05 gkvappium

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()

SvetoslavTsenov avatar May 15 '19 08:05 SvetoslavTsenov

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

gkvappium avatar May 15 '19 15:05 gkvappium