无法使用硒从谷歌注册页面的下拉列表中选择月份



我正在尝试使用Selenium从Google注册页面中选择一个月。下面是我的代码:

driver.get("https://accounts.google.com/SignUp");
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
Actions action = new Actions(driver);
action.clickAndHold(driver.findElement(By.id("BirthMonth"))).build().perform();
//clicking and holding the month dropdown         
WebElement menuElement=driver.findElement(By.id(":7"));
action.moveToElement(menuElement).click();

但它没有选择所需的月份。

你忘了在click()中打电话给perform()

action.moveToElement(menuElement).click().perform();

最新更新