org.openqa.selenium.NoSuchElementException:没有这样的元素:无法定位元素:{"method":"css selector","selector":"[name='pass']"}**strong文本*强文本
公共类 test2 {
public static WebDriver driver;
@Test
public void Browse() throws InterruptedException {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
driver.get("https://www.google.com");
driver. Manage().window().maximize();
driver.findElement(By.name("q")).sendKeys("daraz");
driver.findElement(By.xpath("//*[@id=\"tsf\"]/div[2]/div[1]/div[3]/center/input[1]")).click();
driver.findElement(By.xpath("//*[@id=\"rso\"]/div[1]/div/div/div/div[1]/a/h3/span")).click();
driver.findElement(By.xpath("//*[@id=\"anonLogin\"]/a")).click();
driver.findElement(By.xpath("//*[@id=\"container\"]/div/div[2]/form/div/div[2]/div[2]/div/div[2]/button[1]")).click();
driver. Manage().timeouts().implicitly Wait(3, TimeUnit.SECONDS);
driver.findElement(By.name("pass")).sendKeys("Mansur");
}
}