selenium3-java与selenium ide疑难

谷子学长 2019-08-09 09:40:09


将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();
}
}
...全文
83 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

5,219

社区成员

发帖
与我相关
我的任务
社区描述
软件工程/管理 质量管理/软件测试
功能测试压力测试安全性测试 个人社区 湖南省·长沙市
社区管理员
  • 软件测试
  • 虫无涯
  • 小博测试成长之路
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

欢迎大家加入到软件测试的社区,在这里,希望大家勇于发表自己的看法,欢迎大家分享自己在软件测试工作过程中遇到的问题以及工作经验分享。

1.想转行的小伙伴,遇到问题没有及时回复的,可以私聊小博进行反馈

2.大家对社区有好的建议,都可以在社区发帖进行反馈

推荐大家学习的软件测试入门笔记:软件测试入门学习笔记

试试用AI创作助手写篇文章吧