Im also facing the same error. Unable to select Birthday, Gender & Location in gmail signup page. I'm using Selenium Webdriver.
Please find the below code for birthday.
new Select (driver.findElement(By.id(":0"))).selectByValue("January");
On executing the above code it gives me the below error
> Element should have been "select" but was "div".
Following is the complete code.
public class GmailCreate {
public static void main(String args[]) throws InterruptedException
{
WebDriver driver= new FirefoxDriver();
driver.get("http://gmail.com");
//By genderDropdown = By.xpath("//*[@id='Gender']/div");
driver.findElement(By.id("link-signup")).click();
/*driver.findElement(By.id("FirstName")).sendKeys("ABC");
driver.findElement(By.id("LastName")).sendKeys("XYZ");
driver.findElement(By.id("GmailAddress")).sendKeys("abcx0429");
driver.findElement(By.id("Passwd")).sendKeys("pass1word123");
driver.findElement(By.id("PasswdAgain")).sendKeys("pass1word123");
//new Select (driver.findElement(By.id(":0"))).selectByValue("January");
//Select gender = new Select(driver.findElement(genderDropdown));
// gender.selectByVisibleText("Male");*/
//driver.findElement(By.xpath("//span[@id='BirthMonth']/div")).click();
Thread.sleep(2000);
// driver.findElement(By.id(":3")).click();
/* driver.findElement(By.id("BirthDay")).sendKeys("26");
driver.findElement(By.id("BirthYear")).sendKeys("1988");
driver.findElement(By.id("RecoveryPhoneNumber")).sendKeys("9876543210");
driver.findElement(By.id("RecoveryEmailAddress")).sendKeys("[email protected]");
if ( !driver.findElement(By.id("SkipCaptcha")).isSelected() )
{
driver.findElement(By.id("SkipCaptcha")).click();
System.out.println("Marked");
}
else
{
System.out.println("Already Marked");
}
if (!driver.findElement(By.id("TermsOfService")).isSelected())
{
driver.findElement(By.id("TermsOfService")).click();
}
driver.findElement(By.id("submitbutton")).click();*/
WebElement monthDropdown = driver.findElement(By.xpath("//div[@class='goog-inline-block goog-flat-menu-button jfk-select goog-flat-menu-button-focused goog-flat-menu-button-hover']"));
// Select month
Select month= new Select(monthDropdown);
month.selectByVisibleText("March");
// enter birth day
WebElement DayTbox = driver.findElement(By.xpath("//input[@id='BirthDay']"));
DayTbox.clear();
DayTbox.sendKeys("20");
// Enter Birth Year
WebElement YearTbox = driver.findElement(By.xpath("//input[@id='BirthYear']"));
YearTbox.clear();
YearTbox.sendKeys("2010");
}
}