Selenium 如何从下拉菜单中自动单击和选择并保存?

Selenium 如何从下拉菜单中自动单击和选择并保存?,selenium,automation,Selenium,Automation,有一个大约200名学生的数据库,我需要从下拉列表中选择2个项目,然后点击最后的保存按钮。 手动操作大约需要5-6秒。我想知道是否有可能实现自动化? 截图如下: 然后选择2项: 最后点击“保存”按钮: 在selenium中,您可以这样做: WebElement mySelectElement = driver.findElement(By.id("id of the dropdown")); Select dropdown= new Select(mySelectElement); drop

有一个大约200名学生的数据库,我需要从下拉列表中选择2个项目,然后点击最后的保存按钮。 手动操作大约需要5-6秒。我想知道是否有可能实现自动化? 截图如下:

然后选择2项:

最后点击“保存”按钮:

在selenium中,您可以这样做:

WebElement mySelectElement = driver.findElement(By.id("id of the dropdown"));
Select dropdown= new Select(mySelectElement);
dropdown.selectByIndex(2);//select it by index
driver.findElement(By.id("id of your button")).click();

在selenium中,您可以这样做:

WebElement mySelectElement = driver.findElement(By.id("id of the dropdown"));
Select dropdown= new Select(mySelectElement);
dropdown.selectByIndex(2);//select it by index
driver.findElement(By.id("id of your button")).click();

共享文本格式的下拉列表和保存按钮的html。共享文本格式的下拉列表和保存按钮的html。