J'automatisant le site Web à l'aide Sélénium WebDriver et au-dessous est le code, le code échoue avec le message d'erreurLe côté gauche d'une affectation doit être une variable Sélénium WebDriver XPATH
La gauche côté d'une affectation doit être une variable pour l'identification le champ de connexion en utilisant le XPATH, j'utilise XPATH depuis l'ID et nom sont déjà échoué et quand j'utilise le XPATH le message d'erreur ci-dessous est rempli, s'il vous plaît aider à corriger le code
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
public class FirstClass {
private static final String SeleniumWait = null;
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver",
"C:\\Users\\Documents\\Selenium\\chromedriver_win32\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.amazon.com/");
driver.findElement(By.id("nav-link-accountList")).click();
driver.findElement(By.id("signin")).click();
WebDriverWait wait = new WebDriverWait(driver, 60);// 1 minute
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("//*
[@id="ap_email"]")));
//chrome.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.findElement(By.id("//*
[@id="ap_email"]")).sendKeys("[email protected]");
/*driver.findElement(By.id("ap_assword")).sendKeys("Teachme100$");
driver.findElement(By.id("signInSubmit")).click();
//driver.close();*/
/*WebElement ap_email = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.presenceOfElementLocated(By.id("ap_email")));*/
}
public static String getSeleniumwait() {
return SeleniumWait;
}
}
Le code avec l'erreur dans Eclipse est driver.findElement (By.id ("// * [@ id =" ap_email"] ")). sendKeys (" [email protected] "); XPATH =" // * [@ id = "ap_email" – Rajkumar