




将ide录制的java代码导出,找不到action类,我使用selenium-java-3.141.59.jar包,以及java-sever-standalone-3.141.59.jar包和最新的geck驱动
selenium-java-3.141.59是我在官网找到的最新的jar包
selenum ide我也是用的3.12版本,最新版
火狐最新版68
我导入了selenium3与selenium ide的支持包,官网上明确说明了用一个支持包selenium3即可运行ide导出案例,然后,全部配好后依旧告诉我 cant resolve the type ,找不到action类型
录制的代码如下
// Generated by Selenium IDE
package selenium_3_8_9;
import org.junit.Test;
import org.junit.Before;
import org.junit.After;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.IsNot.not;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Alert;
import org.openqa.selenium.Keys;
import java.util.*;
public class Lyz810Test {
private WebDriver driver;
private Map<String, Object> vars;
JavascriptExecutor js;
@Before
public void setUp() {
driver = new FirefoxDriver();
js = (JavascriptExecutor) driver;
vars = new HashMap<String, Object>();
}
@After
public void tearDown() {
driver.quit();
}
@Test
public void lyz810() {
driver.get("http://XXXXXXXXXXXX/");
driver.manage().window().setSize(new Dimension(1936, 1056));
driver.findElement(By.linkText("后台管理")).click();
driver.findElement(By.id("username")).click();
driver.findElement(By.id("username")).sendKeys("camp2019");
driver.findElement(By.id("password")).sendKeys("XXXXX");
driver.findElement(By.cssSelector(".btn-login")).click();
driver.findElement(By.cssSelector(".nav-hover span")).click();
driver.findElement(By.linkText("教职工管理")).click();
driver.findElement(By.linkText("学生管理")).click();
driver.findElement(By.id("region2Li")).click();
{
WebElement element = driver.findElement(By.id("region3Li"));
Actions builder = new Actions(driver);
builder.moveToElement(element).perform();
}
driver.findElement(By.id("region3Li")).click();
{
WebElement element = driver.findElement(By.tagName("body"));
Actions builder = new Actions(driver);
builder.moveToElement(element, 0, 0).perform();
}
driver.findElement(By.cssSelector(".btn:nth-child(8)")).click();
{
WebElement dropdown = driver.findElement(By.id("modleStudentGradeId"));
dropdown.findElement(By.xpath("//option[. = '请选择年级']")).click();
}
{
WebElement dropdown = driver.findElement(By.id("modleStudentClassId"));
dropdown.findElement(By.xpath("//option[. = '请选择班级']")).click();
}
{
WebElement dropdown = driver.findElement(By.id("personnelSex"));
dropdown.findElement(By.xpath("//option[. = '请选择性别']")).click();
}
{
WebElement dropdown = driver.findElement(By.id("liveInDormitorySign"));
dropdown.findElement(By.xpath("//option[. = '是否住校']")).click();
}
{
WebElement dropdown = driver.findElement(By.id("pickUpSign"));
dropdown.findElement(By.xpath("//option[. = '是否接送']")).click();
}
{
WebElement element = driver.findElement(By.cssSelector(".btn:nth-child(8)"));
Action builder = new Actions(driver);
builder.moveToElement(element).perform();
}
{
WebElement element = driver.findElement(By.tagName("body"));
Action builder = new Actions(driver);
builder.moveToElement(element, 0, 0).perform();
}
driver.findElement(By.cssSelector(".form-group:nth-child(1) > .col-lg-8 .filter-option-inner-inner")).click();
driver.findElement(By.cssSelector(".form-group:nth-child(1) > .col-lg-8 li:nth-child(2) .text")).click();
{
WebElement dropdown = driver.findElement(By.id("modleStudentGradeId"));
dropdown.findElement(By.xpath("//option[. = '高二年级']")).click();
}
driver.findElement(By.cssSelector(".form-group:nth-child(2) .filter-option-inner-inner")).click();
driver.findElement(By.cssSelector(".form-group:nth-child(2) li:nth-child(2) .text")).click();
{
WebElement dropdown = driver.findElement(By.id("modleStudentClassId"));
dropdown.findElement(By.xpath("//option[. = '高二年级-1班']")).click();
}
driver.findElement(By.cssSelector(".form-group:nth-child(3) .filter-option-inner-inner")).click();
driver.findElement(By.linkText("男")).click();
{
WebElement dropdown = driver.findElement(By.id("personnelSex"));
dropdown.findElement(By.xpath("//option[. = '男']")).click();
}
driver.findElement(By.cssSelector(".form-group:nth-child(4) .filter-option-inner-inner")).click();
driver.findElement(By.linkText("住校")).click();
{
WebElement dropdown = driver.findElement(By.id("liveInDormitorySign"));
dropdown.findElement(By.xpath("//option[. = '住校']")).click();
}
driver.findElement(By.cssSelector("#addStudentMessageModel .modal-footer > .btn-default")).click();
driver.findElement(By.linkText("关闭")).click();
driver.findElement(By.cssSelector(".nav-hover span")).click();
driver.findElement(By.linkText("课程考勤")).click();
driver.findElement(By.cssSelector(".nav-hover span")).click();
driver.findElement(By.cssSelector(".nav-hover span")).click();
driver.findElement(By.linkText("区域考勤")).click();
driver.findElement(By.cssSelector(".nav-hover span")).click();
}
}