I am currently facing a challenge while attempting an automated test on Facebook. The issue lies in clicking the "Create Account" button using FindElement by id, which is not functioning as expected.
public void createAccount(String firstName, String lastName, String emailAddress, String userPassword) {
driver.findElement(By.id("u_0_2_OE")).click();
WebElement firstNameElement = driver.findElement(By.name("firstname"));
firstNameElement.sendKeys("Test");
WebElement lastNameElement = driver.findElement(By.name("lastname"));
lastNameElement.sendKeys("Alfasoft");
WebElement emailElement = driver.findElement(By.name("reg_email__"));
emailElement.sendKeys("<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="791f181b1016570d1c0a0d1c3918151f180a161f0d57090d">[email protected]</a>");
WebElement passwordElement = driver.findElement(By.name("reg_passwd__"));
passwordElement.sendKeys("AlfasoftTeste_");
driver.findElement(By.name("birthday_day")).click();
WebElement dayElement = driver.findElement(By.id("day"));
dayElement.sendKeys("6");
driver.findElement(By.name("birthday_month")).click();
WebElement monthElement = driver.findElement(By.id("month"));
monthElement.sendKeys("Aug");
driver.findElement(By.name("birthday_year")).click();
WebElement yearElement = driver.findElement(By.id("year"));
yearElement.sendKeys("1999");
driver.findElement(By.id("u_h_3_BO")).click();
driver.findElement(By.name("websubmit")).click();
}
(I am invoking this code in another Class using:
public static void main(String[] args)
throws Exception and then tarefa2Project.createAccount("firstName", "lastName", "emailAddress", "userPassword");
...