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.

Radios, checkboxes, and switches

Radios, checkboxes, and switches

In this lesson, we'll learn about the actions which we can perform on a radio button, check box and switches. So first of all, let's go ahead and select the element to do that or go ahead and inspect the same first. And you will see this as a form check element with an input element and a label for the same. ahead and locate it using the get by label locator and i'll go ahead and copy the label for the same so what we can do is use our page get by label locator and the label says this and if i go ahead and store the same in a radio option it's option two so i'll go ahead and name it accordingly and now if i want to check the same that is i'm going to select this option we can actually just click it but for these things we have a separate method for the same which is called check and if i go ahead and execute the same you can see our radio button getting checked now the same applies for the upper option. So if I go ahead and create a radio option one and have the page get by label…

Contents