1
Follow the code. Selenium does not find the element:
package test;
import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
public class pages {
static WebDriver navegador;
@BeforeClass
public static void abrirNavegador() {
System.setProperty("webdriver.chrome.driver", "C:\\Automacao\\chromedriverV36_win32\\chromedriver.exe");
navegador = new ChromeDriver();
navegador.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
navegador.get("https://www.centraldacorrida.com.br/");
navegador.manage().window().maximize();
}
@Test
public void paginaLogin() {
navegador.findElement(By.name("j_username")).sendKeys("C001104");
}
@AfterClass
public static void posCondicao() {
// navegador.close();
}
}
Trace error:
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"name","selector":"j_username"}