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.
Assertions option menu
From the course: Playwright Python and Pytest for Web Automation Testing: Master Modern Web Testing with Playwright and Pytest in Python
Assertions option menu
In this lesson, we'll learn how to expect a option menu or a select menu to have a specific value selected. For our test, we'll use bootswatch.com which has our example select menu. You can see by default it comes with 1 as selected. And we'll expect the same. Now to locate this we can simply make use of this label which is example select. So let's go ahead and do that. So our option menu will be page get by label locator and the label is example select. Now we can go ahead and expect the option menu to have a value. Now the value is 1, and by default that should be the case. So let's go ahead and run our test. We launch boot swatch, locate the element, check the same, and we pass the test. Great. Now if we have a multiple select menu like this, we can select multiple options. We can also expect the same to have multiple values. So let's go ahead and first of all select it. So we'll go ahead and select a multi option menu and the label is example multi select. So example multi select…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.