这是出错的原因
1/org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//html1/*/div[@id='gnmk']/div[1]/div/ul/li[1]"}
这是我的脚本
2/public void test() throws InterruptedException {
System.setProperty("webdriver.chrome.driver","C:/Program Files (x86)/Google/Chrome/Application/chromedriver.exe"); //配置ChromeDriver的环境变量
//启动chrome 浏览器
driver = new ChromeDriver();//实例化一个Chrome浏览器
System.out.println("恭喜你,已经成功启动Chrome浏览器");
//最大化窗口
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--start-maximized");
driver = new ChromeDriver(chromeOptions);
driver.get("http://192.168.1.70:86/jsp/login.jsp");
//登陆
driver.findElement(By.id("username")).clear();
driver.findElement(By.id("username")).sendKeys("xy2222");
driver.findElement(By.id("password")).clear();
driver.findElement(By.id("password")).sendKeys("111111");
driver.findElement(By.id("login")).click();
//卡种类
Thread.sleep(3000);
driver.switchTo().frame(0);
driver.findElement(By.xpath("//html1/*/div[@id='gnmk']/div[1]/div/ul/li[1]")).click();
driver.switchTo().defaultContent();//退出富文本框
}