Gmail Creation Script
Gmail Creation Script
driver.get("https://accounts.google.com/signup");
String firstname = generateRandomName();
String username = generateUsername(firstname);
String mailpassword = "Test@12345";
creategmailaccount(driver, wait, firstname,username, mailpassword);
Thread.sleep(3000);
} catch (Exception e) {
e.printStackTrace();
}
}
driver.quit();
}
// Locate the "Create your own Gmail address" element and click it
WebElement customGmailButton =
driver.findElement(By.xpath("//div[contains(text(),'Create your own Gmail
address')]") );
customGmailButton.click();
Thread.sleep(3000);
WebElement usernameField =
driver.findElement(By.xpath("//input[@name='Username']"));
//
// Locate the "Password" input field and enter a value
WebElement passwordField =
driver.findElement(By.xpath("//input[@name='Passwd']"));
for (char c : mailpassword.toCharArray()) {
passwordField.sendKeys(Character.toString(c));
Thread.sleep(200 + (int)(Math.random() * 300));
}
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
}
wait.until(ExpectedConditions.elementToBeClickable(By.name("Username")));
WebElement usernameField;
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
usernameField = driver.findElement(By.xpath("//input[@name='Username']"));
usernameField.clear();
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return true;
}