If you've ever written a TestCafe test, you may be familiar with the following errors:
- Cannot obtain information about the node because the specified selector does not match any node in the DOM tree.
- The specified selector does not match any element in the DOM tree.
- The element that matches the specified selector is not visible.
The first two errors are self-explanatory. The last error, however, can easily be misinterpreted. This error frequently occurs if multiple elements match the same selector. The first matching element may be hidden, while the required element is visible.
What should you do next? How do you update the selector so that it produces expected results? What should you do if the test previously passed, but it now fails?
If you're writing functional tests, you may need to scroll tested pages to display specific elements. In this article, we look at several test scenarios to show how TestCafe navigates pages.