|Ruby| How does one assert that certain element is not visible on the screen
See original GitHub issueAssert that element is not visible on the screen
Hi guys, I am having difficulties to assert that certain text is not visible on the screen. I have tried my luck with RSpec Expectations, and different approaches which would be working for web app. However with Appium it does not seem to work.
Here is the link of what I have tried: http://stackoverflow.com/questions/38372530/appium-how-does-one-assert-that-certain-text-is-not-displayed-on-the-screen
There are many examples, how to assert that something IS visible, and that is working as expected. However when its vice versa then it is not going smoothly.
What is your experience in this situation?
Environment
* Mobile app - iOS
* Appium 1.5.2 + Cucumber + WatirWebdriver + Ruby + RSpec Expectations
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
rspec - |Appium - Ruby| How does one assert that certain text ...
In a scenario I want to assert that text "Something" is not displayed on the screen. This is a test for mobile iOS...
Read more >Quicker way to assert that an element does not exist
This works fine for the test: to assert if the popup exists. But as soon as I change the goal to: assert if...
Read more >Check Visibility of Web Elements Using Various Types ...
The method returns a “true” value if the specified web element is present on the web page and a “false” value if the...
Read more >How to check that an element does not exist on the screen ...
In today's “Pinches of Cypress”, learn how to check that an element is not present at the DO... Tagged with cypress, testing, automtion, ......
Read more >Verifying whether an element present or ... - Tutorialspoint
To check the visibility of an element in a page, the method isDisplayed is used. It returns a Boolean value( true is returned...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m using Appium Ruby bindings and here is an example what I do in such cases:
Same example with a text that is visible on screen:
No problem - hope this brief explanation helps.
wait_true { ignore { text('text that is not visible on screen') }.nil? }
wait_true
,ignore
andtext
are Appium Ruby binding methods and can be found from project: https://github.com/appium/ruby_libtext
will return the first “textfield” element with given text. Since such element is not going to be found it will throw an exception. We will catch exception withignore
block. When text is not foundignore
block will returnnil
. Finally we usewait_true
block to poll that return value isnil
meaning text is not visible on the screen.