Em đang học về selenium. Em có viết 1 đoạn code nhưng nó không chạy. Nhờ mọi người xem hộ em
Nó báo lỗi ở dòng verify cuối cùng ý ạ:
Multiple markers at this line
- The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from
required .class files
- The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class
files
Dưới đây là code:
@BeforeTest
public void init()
{
System.setProperty("webdriver.firefox.marionette", "../browser/geckodriver.exe");
driver= new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
//Hàm mở page
@Test
public void openPage(){
driver.get("http://192.168.146.252:9013/tts-person/index");
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
//Hàm login chạy sau hàm openpage
@Test(dependsOnMethods={"openPage"})
public void loginSuccess()
{
JavascriptExecutor js = (JavascriptExecutor)driver;
WebElement txtUser = driver.findElement(By.id("loginform-username"));
WebElement txtPas = driver.findElement(By.id("loginform-password"));
WebElement btnLogin = driver.findElement(By.xpath(".//*[@id='login-form']/div[@class='form-actions']/button"));
//Nhap user, pass
js.executeScript("arguments[0].value=arguments[1]", txtUser,"admin");
js.executeScript("arguments[0].value=arguments[1]",txtPas,"123456a@");
btnLogin.click();
WebElement check = driver.findElement(By.xpath("html/body/div[3]/div[1]/div/ul/li[2]/a/span"));
String actural = check.getText();
//loi run dc
Assert.assertEquals(actural, "thực tế");
}
Em dùng jdk 1.8