Код: Выделить всё
mvn clean test
[ОШИБКА] Не удалось выполнить цель
org.apache.maven.plugins:maven-compiler-plugin:3.2:testCompile
(default-testCompile) в проекте suman: ошибка компиляции [ОШИБКА]
/home/oleg/WebstormProjects/ oresoftware/sumanjs/sce-test/suman/src/test/java/suman/SeleniumTest.java:[21,15]
невозможно получить доступ к файлу класса org.openqa.selenium.HasInputDevices [ОШИБКА]
для org.openqa.selenium.HasInputDevices не найден
Я смотрю на это:
https://seleniumhq.github.io/selenium/d ... vices.html
Похоже на мой Проблема возникает из-за FirefoxDriver или ChromeDriver.
Вот мой файл pom.xml:
Код: Выделить всё
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
suman
suman
jar
1.0-SNAPSHOT
suman
http://maven.apache.org
junit
junit
4.12
test
org.seleniumhq.selenium
htmlunit-driver
2.29.0
org.seleniumhq.selenium
selenium-java
2.21.0
org.seleniumhq.selenium
selenium-chrome-driver
2.0rc3
org.seleniumhq.selenium
selenium-firefox-driver
2.0rc3
Код: Выделить всё
package suman;
import java.util.concurrent.TimeUnit;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.*;
import org.openqa.selenium.interactions.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class SeleniumTest {
private static FirefoxDriver driver;
private WebElement element;
@BeforeClass
public static void openBrowser(){
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}
@Test
public void valid_UserCredential(){
System.out.println("Starting test " + new Object(){}.getClass().getEnclosingMethod().getName());
driver.get("http://www.store.demoqa.com");
driver.findElement(By.xpath(".//*[@id='account']/a")).click();
driver.findElement(By.id("log")).sendKeys("testuser_3");
driver.findElement(By.id("pwd")).sendKeys("Test@123");
driver.findElement(By.id("login")).click();
try{
element = driver.findElement (By.xpath(".//*[@id='account_logout']/a"));
}catch (Exception e){
}
Assert.assertNotNull(element);
System.out.println("Ending test " + new Object(){}.getClass().getEnclosingMethod().getName());
}
@Test
public void inValid_UserCredential()
{
System.out.println("Starting test " + new Object(){}.getClass().getEnclosingMethod().getName());
driver.get("http://www.store.demoqa.com");
driver.findElement(By.xpath(".//*[@id='account']/a")).click();
driver.findElement(By.id("log")).sendKeys("testuser");
driver.findElement(By.id("pwd")).sendKeys("Test@123");
driver.findElement(By.id("login")).click();
try{
element = driver.findElement (By.xpath(".//*[@id='account_logout']/a"));
}catch (Exception e){
}
Assert.assertNotNull(element);
System.out.println("Ending test " + new Object(){}.getClass().getEnclosingMethod().getName());
}
@AfterClass
public static void closeBrowser(){
driver.quit();
}
}
Подробнее здесь: https://stackoverflow.com/questions/487 ... -not-found
Мобильная версия