It doesn't validate a message which appears and disappears

Ask general questions here.
iana11
Posts: 3
Joined: Wed Feb 05, 2020 10:27 am

It doesn't validate a message which appears and disappears

Post by iana11 » Tue Feb 25, 2020 11:44 am

Hello,

I have to validate in my web app if a message is shown when you save something, and validate the message's text. This is a text which appears after saving an element and disappears after 5 seconds.
I copied the full XPath of this and is like:
/html/body/div[2]/div/div/snack-bar-container/simple-snack-bar/span[@innertext=' message-text '] ,
but when I run the test, it doesn't find the message.
Has anyone any idea about how to solve this problem?

Many thanks,
iana11
:D :D

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5776
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: It doesn't validate a message which appears and disappears

Post by odklizec » Wed Feb 26, 2020 8:17 am

Hi,

basically, you should create a repo item, with xpath like this:

Code: Select all

/html/body//snack-bar-container/simple-snack-bar/span[@innertext=' message-text ']
Then you can either use WaitFor Exist action or Validate Exists, right after the clicking the Save button (or whatever 'Save' operation you do). Once the text appears, Validate Exists should validate the existence and continue with test. If you use Wait For Exists, it should pause the test until the text appears or until expires defined 'wait' timeout.

However, I would strongly suggest to add the browser you are using to Ranorex white list. This should speed the element search. The problem could be, that if the search for element is too slow (with given xpath), the both Wait For or Validate action could "miss" the appearance of text, due to 5sec timeout you suggested. So you must do everything to make the search as fast as possible. Aside of adding browser to the white list, you may also need to edit the xpath, to make it faster to find. Could you please share a Ranorex snapshot, with captured message, so we can evaluate "better" xpath possibilities? ;) Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

iana11
Posts: 3
Joined: Wed Feb 05, 2020 10:27 am

Re: It doesn't validate a message which appears and disappears

Post by iana11 » Wed Feb 26, 2020 9:38 am

Hello,
Thank you for the answer.
Here is a screenshot of the record:
screenshot rnx.png
screenshot rnx.png (39.98 KiB) Viewed 46 times
The message that should appear is: "AUSWAHLFELD WURDE ERFOLGREICH ANGELEGT."

Regards,
iana11
Attachments
SomeSpanTag_Screenshot_1ead1bb4-aa3f-4066-bb1a-76b69ea9e16a.jpg
SomeSpanTag_Screenshot_1ead1bb4-aa3f-4066-bb1a-76b69ea9e16a.jpg (5.48 KiB) Viewed 46 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5776
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: It doesn't validate a message which appears and disappears

Post by odklizec » Wed Feb 26, 2020 9:43 am

Hi,

What you've posted is screenshot ;) Please post a Ranorex snapshot instead...
https://www.ranorex.com/help/latest/ran ... hot-files/
Thanks.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

iana11
Posts: 3
Joined: Wed Feb 05, 2020 10:27 am

Re: It doesn't validate a message which appears and disappears

Post by iana11 » Thu Feb 27, 2020 2:43 pm

I found the right XPath and now it works but thank you anyway!