Olá,
Como o identificador name não existe mais, tentei pelo id, porém sem sucesso. O meu código está assim:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class TesteAutomatizado {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
WebDriverWait wait = new WebDriverWait(driver,10);
driver.get("http://www.google.com.br");
WebElement campoDeTexto = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("realbox")));
campoDeTexto.sendKeys("Caelum");
campoDeTexto.submit();
}
}
A mensagem de erro
Exception in thread "main" org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of element located by By.id: realbox (tried for 10 second(s) with 500 milliseconds interval)
at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:95)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:272)
at TesteAutomatizado.main(TesteAutomatizado.java:16)
Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"#realbox"}
(Session info: chrome=84.0.4147.125)