5

I am trying to add an assertion on the shown toast message in my scenario, Is there a way to stop the screen to find the element of a toast message?

1

This is how we solved the exact same problem in Protractor(Selenium):

 browser.wait(EC.visibilityOf($('.toast-message')), Timeout_Short()).then(function () {
      $('.toast-message').getAttribute('innerText').then(function (innerText) {
         //Do your validations
      })
 })
1

No, currently there is no way to pause the application with Appium. I doubt this would help you, cause the pause command probably would also come too late.

Maybe this is a functional issue, because if the message disappears so fast how can the user observe it? I would expect the message to show for X seconds, this should be long enough for an automated test to observe it.

Maybe you have some waits in your test that prevent it from polling just after the action that triggers the message. I don't have experience with Appium, but Selenium is so fast that things only show for milliseconds would be enough time to get the element and its text. I would expect this to be similar in Appium, so I would analyse your test execution step by step.

Alternatively, discuss this with the developers, make the toast message timeout configurable and change this for your test environment.

-1

You can use below steps to capture that kind of elements

  1. Install the selenium IDE in your browser and do the particular test manually and record it using selenium IDE.

  2. When the message appear in the page click on that message before disappear.

  3. Selenium IDE will capture that element and store it when you click on that element. (you will get notification)

  4. You can use that captured xpath or id for your automation.

1
  • 2
    How does the Selenium IDE work on Android with Appium? May 18 '20 at 10:52
-1

Open the page in Chromes Dev tools, switch to the sources tab, trigger your Toast and stop the page via F8 or the pause button in the left corner of the right section. You'll still be able to select elements in the Elements Tab but any JS on the page will be paused.

1
  • 2
    This is about Appium on Android see tags. Also manual pausing does not help automated tests. :) May 18 '20 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.