From the course: Advanced Selenium: Page Objects and GUI Automation

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Element abstractions

Element abstractions

From the course: Advanced Selenium: Page Objects and GUI Automation

Start my 1-month free trial

Element abstractions

- [Instructor] Now, I want to demonstrate how Element Abstractions can make the tests more semantically precise, and reduce the complexity of working with onscreen elements. This test, the Element Abstractions Test, uses the checkbox on the to-do list. So first it navigates directly to a to-do list. It creates three to-do's. And then, in the test itself, it works with one of the check boxes to toggle it. It interacts with it on lines 39 and 40. And then on lines 42 through to 45, it asserts the status of the check boxes. And this test is using the WebElement. And we can see with core completion that the WebElement has a lot of methods because it's a very generic abstraction for an item on the screen. The click kind of makes sense because we click on a check box, sendKeys might make sense because we could possibly use a keyboard to control it, getText doesn't really add any value in this context. And a check box doesn't…

Contents