课程: Test Automation with Selenium WebDriver for Java

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Drop-down menus

Drop-down menus

- [Speaker] Dropdown menus allow users to select one or more options from a list and are typically represented by the select element that contains one or more option elements to choose from. Let's explore how to use Web Driver to interact with select elements. While Web Driver provides generic methods to interact with standalone web elements, dropdown menus consist of both select and option elements. This unique component requires specialized handling, and fortunately, we can use Selenium's select class, which provides methods specifically for interacting with dropdown menus. We'd find the select element, just as we would with any other element, so let's say driver.findeEement, and we can say By.name, and the name of that dropdown is my-select, but then we substantiate a select object with this element. So let's use our select class and we'll call this dropdown and we'll say, this equals a new, and we'll call the select constructor and pass in this driver.findElement. Select provides…

内容