Skip to content

Get Text from alert message #224

Open

Description

@gkvappium

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?

Activity

  1. SvetoslavTsenov commented on May 15, 2019

    @SvetoslavTsenov
    Contributor

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

  2. gkvappium commented on May 15, 2019

    @gkvappium
    Author

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions