Selenium - 无法解析java.lang.CharSequence类型。它是从所需的.class文件间接引用的 我是硒的新手,有人可以帮忙吗?
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.ie.driver",System.getProperty("user.dir")+ "\\iedriver\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();
driver.get("https://accounts.google.com/ServiceLogin?continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&service=mail&sacu=1&rip=1#identifier");
WebElement username = driver.findElement(By.id("Email"));
username.sendKeys("selenium");
}
答案 0 :(得分:0)
将此代码与Chrome驱动程序/浏览器一起使用:
package demo;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class TestAnyURLMain {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Utility\\BrowserDrivers\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.google.co.in/");
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.findElement(By.xpath(".//*[@id='gbw']/div/div/div[1]/div[1]/a")).click();
driver.findElement(By.id("Email")).sendKeys("ABC");
}
}
让我知道它是否对你有所帮助。