From the course: Playwright Python and Pytest for Web Automation Testing: Master Modern Web Testing with Playwright and Pytest in Python

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

UI testing visibility

UI testing visibility

For this test, we have to check the visibility of these elements for different conditions. That is, in our test info, we have like an element may be removed, which is invisible. Then an element may have zero width and height. Now it is visible technically, but is not covering any space in our viewport. We can also check whether or not an element is overlapped by another element, which renders it invisible to us, but it is still in the document. Then there's another case where it may be hidden using opacity set to zero, the visibility set to hidden or the display set to none. And the last thing is that the element may be moved off screen entirely with its offset. In this test, we'll go ahead and perform these checks in these respective buttons. So the first thing is to locate all of these buttons and we'll do that using their button role and the text on the same. So let's go ahead and write the locators for all of the buttons. So hide button by use get by role locator. rule is button…

Contents