[Solved] How to create Gmail account using Selenium, I am having trouble with month and country drop downs


As I see at here the month drop down box is not actually a select element, you should try using Actions as below:

WebDriverWait wait = new WebDriverWait(d, 10);
Actions builder = new Actions(d);

WebElement selectMonth = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@title="Birthday"]")));
builder.mouse.mouseMove(((Locatable)selectMonth).coordinates);      
selectMonth.click();

WebElement option = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[text() = 'May']")));
builder.mouse.mouseMove(((Locatable)option).coordinates);   
option.click();
System.out.println("may slected...");

Edited: if you want to print all months try after clicking on BirthMonth dropdown as below:

WebElement selectMonth = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//div[@title="Birthday"]")));
builder.mouse.mouseMove(((Locatable)selectMonth).coordinates);      
selectMonth.click();

List<WebElement> allmonths = wait.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.cssSelector("span#BirthMonth > div.goog-menu.goog-menu-vertical")));
for(WebElement el : allmonths) {
            System.out.println(el.getText())
}

Note however that if the purpose is to create large numbers of GMail accounts, Google will shut down these attempts pretty quickly, and will start to return server errors or apply IP blocks.

9

solved How to create Gmail account using Selenium, I am having trouble with month and country drop downs