本文介绍了“缺少或无效'entry.level'" selenium webdriver中的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在学习Selenium Webdriver。我试图通过谷歌登录Quora。但在电子邮件输入部分,代码无法正常工作。我无法弄清问题是什么。请帮忙。以下是我的代码
import org.openqa。*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Demo2 {
public static void main(String [] args){
System.setProperty(webdriver.chrome.driver,C:\\chromedriver.exe );
WebDriver driver = new ChromeDriver();
String url =https://quora.com;
driver.get(url);
WebElement ele1 = driver.findElement(By.className(google_button_text));
ele1.click();
// WebElement e1 = driver.findElement((By.xpath(// * [@ id ='identifierId'])));
//e1.sendKeys(欢迎);
WebElement email1 = driver.findElement(By.name(identifier));
email1.sendKeys(fggffgfd);
WebElement next1 = driver.findElement(By.className(RveJvd snByac)); // whsOnd zHQkBf
next1.click();
WebElement password = driver.findElement(By.className(whsOnd zHQkBf));
password.click();
password.sendKeys(Sffgdffdf3);
WebElement next2 = driver.findElement(By.className(RveJvd snByac)); // whsOnd zHQkBf
next2.click();
}
}
我是什么尝试过:
import org.openqa。*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Demo2 {
public static void main(String [] args){
System.setProperty(webdriver.chrome.driver,C:\\chromedriver.exe );
WebDriver driver = new ChromeDriver();
String url =https://quora.com;
driver.get(url);
WebElement ele1 = driver.findElement(By.className(google_button_text));
ele1.click();
// WebElement e1 = driver.findElement((By.xpath(// * [@ id ='identifierId'])));
//e1.sendKeys(欢迎);
WebElement email1 = driver.findElement(By.name(identifier));
email1.sendKeys(fggffgfd);
WebElement next1 = driver.findElement(By.className(RveJvd snByac)); // whsOnd zHQkBf
next1.click();
WebElement password = driver.findElement(By.className(whsOnd zHQkBf));
password.click();
password.sendKeys(Sffgdffdf3);
WebElement next2 = driver.findElement(By.className(RveJvd snByac)); // whsOnd zHQkBf
next2.click();
}
}
解决方案
Hi,I am learning Selenium Webdriver. I was trying to login "Quora" through Google. but in the email typing section, the code is not working. I am not able to figure out what is the problem. Please help. Below is my code
import org.openqa.*; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class Demo2 { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe"); WebDriver driver=new ChromeDriver(); String url="https://quora.com"; driver.get(url); WebElement ele1=driver.findElement(By.className("google_button_text")); ele1.click(); //WebElement e1=driver.findElement((By.xpath("//*[@id='identifierId']"))); //e1.sendKeys("Welcome"); WebElement email1=driver.findElement(By.name("identifier")); email1.sendKeys("fggffgfd"); WebElement next1=driver.findElement(By.className("RveJvd snByac")); //whsOnd zHQkBf next1.click(); WebElement password=driver.findElement(By.className("whsOnd zHQkBf")); password.click(); password.sendKeys("Sffgdffdf3"); WebElement next2=driver.findElement(By.className("RveJvd snByac")); //whsOnd zHQkBf next2.click(); } }
What I have tried:
import org.openqa.*; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class Demo2 { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\\chromedriver.exe"); WebDriver driver=new ChromeDriver(); String url="https://quora.com"; driver.get(url); WebElement ele1=driver.findElement(By.className("google_button_text")); ele1.click(); //WebElement e1=driver.findElement((By.xpath("//*[@id='identifierId']"))); //e1.sendKeys("Welcome"); WebElement email1=driver.findElement(By.name("identifier")); email1.sendKeys("fggffgfd"); WebElement next1=driver.findElement(By.className("RveJvd snByac")); //whsOnd zHQkBf next1.click(); WebElement password=driver.findElement(By.className("whsOnd zHQkBf")); password.click(); password.sendKeys("Sffgdffdf3"); WebElement next2=driver.findElement(By.className("RveJvd snByac")); //whsOnd zHQkBf next2.click(); } }
解决方案
这篇关于“缺少或无效'entry.level'" selenium webdriver中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!