Maven не может сделать build проекта. Выдаёт ошибку package org.openqa.selenium does not exist

Всем привет.
У нас только началась автоматизация тестирования в компании.
На данный момент у меня есть проект в IntelliJ IDEA с тестами на junit4. Отдельный запуск класса с тестами работает нормально.
Но при попытке сделать build проекта, с помощью maven, компилятор выдаёт ошибки :

[ERROR] /C:/Users/Matt/IdeaProjects/TestForKeepGo/src/main/java/com/company/App.java:[5,27] package org.openqa.selenium does not exist
[ERROR] /C:/Users/Matt/IdeaProjects/TestForKeepGo/src/main/java/com/company/App.java:[6,27] package org.openqa.selenium does not exist
[ERROR] /C:/Users/Matt/IdeaProjects/TestForKeepGo/src/main/java/com/company/App.java:[7,34] package org.openqa.selenium.remote does not exist
[ERROR] /C:/Users/Matt/IdeaProjects/TestForKeepGo/src/main/java/com/company/App.java:[8,34] package org.openqa.selenium.remote does not exist
[ERROR] /C:/Users/Matt/IdeaProjects/TestForKeepGo/src/main/java/com/company/App.java:[10,1] package org.openqa.selenium does not exist 

Зависимости в pom.xml я добавил, выглядит это пока что следующим образом:

Запускать тесты мы планируем через сервисы www.saucelabs.com , как и указано в dependencies. что бы прогонять тесты на их виртуальных машинах.

Посоветуйте, как можно решить эту проблему? Может кто-то уже сталкивался с чем-то подобным?

Заранее спасибо)

Вам нужна вот эта зависимость:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>2.47.1</version>
</dependency>
1 лайк

Добавил эту зависимость, но после компиляции те же ошибки.
У меня есть подозрение, что есть проблема в самой структуре проекта, хотя проект я создавал с помощью команд maven в командной строке.
Вот структура проекта:

Уберите в поме скоупы

<scope>test</scope>
1 лайк

теперь выдаёт следующее:

testApp[23](com.company.AppTest)  Time elapsed: 0.002 sec  <<< ERROR!
java.lang.NoSuchMethodError: org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:559)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
    at com.company.AppTest.setUp(AppTest.java:121)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at com.saucelabs.junit.ConcurrentParameterized$SauceClassRunnerForParameters.access$300(ConcurrentParameterized.java:170)
    at com.saucelabs.junit.ConcurrentParameterized$SauceClassRunnerForParameters$2.run(ConcurrentParameterized.java:287)
    at com.saucelabs.junit.ConcurrentParameterized$NonBlockingAsynchronousRunner$1.call(ConcurrentParameterized.java:312)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

testApp[21](com.company.AppTest)  Time elapsed: 0.004 sec  <<< ERROR!
java.lang.NoSuchMethodError: org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:559)
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:128)
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:155)
    at com.company.AppTest.setUp(AppTest.java:121)
    at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
    at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
    at org.junit.rules.RunRules.evaluate(RunRules.java:20)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at com.saucelabs.junit.ConcurrentParameterized$SauceClassRunnerForParameters.access$300(ConcurrentParameterized.java:170)
    at com.saucelabs.junit.ConcurrentParameterized$SauceClassRunnerForParameters$2.run(ConcurrentParameterized.java:287)
    at com.saucelabs.junit.ConcurrentParameterized$NonBlockingAsynchronousRunner$1.call(ConcurrentParameterized.java:312)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)


Results :

Tests in error: 
  testApp[12](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[14](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[5](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[15](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[1](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[6](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[0](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[11](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[2](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[8](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[7](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[13](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[4](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[3](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[9](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[10](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[16](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[17](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[18](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[19](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[20](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[24](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[22](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[23](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V
  testApp[21](com.company.AppTest): org.openqa.selenium.remote.Command.<init>(Lorg/openqa/selenium/remote/SessionId;Ljava/lang/String;Ljava/util/Map;)V

Tests run: 25, Failures: 0, Errors: 25, Skipped: 0

код com.company.AppTest в студию

Вот мой класс с тестами:

package com.company;

import com.saucelabs.common.SauceOnDemandAuthentication;
import com.saucelabs.common.SauceOnDemandSessionIdProvider;
import com.saucelabs.junit.ConcurrentParameterized;
//import com.saucelabs.junit.*;
import com.saucelabs.junit.SauceOnDemandTestWatcher;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.Before;
import org.junit.Rule;
import org.junit.runner.RunWith;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
import java.net.URL;
import java.util.LinkedList;

import static org.junit.Assert.assertTrue;


/**
 * Unit test for simple App.
 */
@RunWith(ConcurrentParameterized.class)
public class AppTest  implements SauceOnDemandSessionIdProvider {

    /*Parameters for Sauce Labs*/
    /**
     * Constructs a {@link SauceOnDemandAuthentication} instance using the supplied user name/access key.  To use the authentication
     * supplied by environment variables or from an external file, use the no-arg {@link SauceOnDemandAuthentication} constructor.
     */
    public SauceOnDemandAuthentication authentication = new SauceOnDemandAuthentication("keepgo", "2aa620e9-a753-49e2-856e-f4d70be43abc");


    @Rule
    public SauceOnDemandTestWatcher resultReportingTestWatcher = new SauceOnDemandTestWatcher(this, authentication);

    private String browser;
    private String os;
    private String version;
    private String sessionId;
    /**
     * The {@link WebDriver} instance which is used to perform browser interactions with.
     */
    private WebDriver driver;

    /**
     * Constructs a new instance of the test.  The constructor requires three string parameters, which represent the operating
     * system, version and browser to be used when launching a Sauce VM.  The order of the parameters should be the same
     * as that of the elements within the {@link #browsersStrings()} method.
     *
     * @param os
     * @param version
     * @param browser
     */
    public AppTest(String os, String version, String browser) {
        super();
        this.os = os;
        this.version = version;
        this.browser = browser;
    }

    /**
     * @return a LinkedList containing String arrays representing the browser combinations the test should be run against. The values
     * in the String array are used as part of the invocation of the test constructor
     */
    @ConcurrentParameterized.Parameters
    public static LinkedList browsersStrings() {
        LinkedList browsers = new LinkedList();
browsers.add(new String[]{"Windows 8.1", "11", "internet explorer"});
browsers.add(new String[]{"Windows 7", "11", "internet explorer"});
browsers.add(new String[]{"OSX 10.8", "6", "safari"});
browsers.add(new String[]{"OS X 10.9", "7.0", "safari"});
browsers.add(new String[]{"OS X 10.9", "44.0", "chrome"});
browsers.add(new String[]{"OS X 10.9", "43", "chrome"});
browsers.add(new String[]{"OS X 10.9", "40.0", "firefox"});
browsers.add(new String[]{"OS X 10.9", "39", "firefox"});
browsers.add(new String[]{"Windows XP", "12.12", "opera"});
browsers.add(new String[]{"Windows XP", "11.64", "opera"});
browsers.add(new String[]{"Windows XP", "40.0", "firefox"});
browsers.add(new String[]{"Windows XP", "39.0", "firefox"});
browsers.add(new String[]{"Windows XP", "44.0", "chrome"});
browsers.add(new String[]{"Windows XP", "43.0", "chrome"});
browsers.add(new String[]{"Windows XP", "8.0", "internet explorer"});
browsers.add(new String[]{"Windows XP", "7.0", "internet explorer"});
browsers.add(new String[]{"Windows 7", "12.12", "opera"});
browsers.add(new String[]{"Windows 7", "11.64", "opera"});
browsers.add(new String[]{"Windows 7", "40.0", "firefox"});
browsers.add(new String[]{"Windows 7", "39.0", "firefox"});
browsers.add(new String[]{"Windows 7", "5.1", "safari"});
browsers.add(new String[]{"Windows 7", "44.0", "chrome"});
browsers.add(new String[]{"Windows 7", "43.0", "chrome"});
browsers.add(new String[]{"Windows 7", "11.0", "internet explorer"});
browsers.add(new String[]{"Windows 7", "10.0", "internet explorer"});

        return browsers;
    }


    /**
     * Constructs a new {@link RemoteWebDriver} instance which is configured to use the capabilities defined by the {@link #browser},
     * {@link #version} and {@link #os} instance variables, and which is configured to run against ondemand.saucelabs.com, using
     * the username and access key populated by the {@link #authentication} instance.
     *
     * @throws Exception if an error occurs during the creation of the {@link RemoteWebDriver} instance.
     */
    @Before
    public void setUp() throws Exception {

        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(CapabilityType.BROWSER_NAME, browser);
        if (version != null) {
            capabilities.setCapability(CapabilityType.VERSION, version);
        }
        capabilities.setCapability(CapabilityType.PLATFORM, os);
        capabilities.setCapability("name", "Sauce Sample Test");
        this.driver = new RemoteWebDriver(
                new URL("http://" + authentication.getUsername() + ":" + authentication.getAccessKey() + "@ondemand.saucelabs.com:80/wd/hub"),
                capabilities);
        this.sessionId = (((RemoteWebDriver) driver).getSessionId()).toString();

    }

    /**
     * Runs a simple test verifying the title of the keepgo.com .
     * @throws Exception
     */

    /***************/////////////////////////************/


    /**
     * @return the suite of tests being tested
     */
    public static Test suite() {
        return new TestSuite(AppTest.class);
    }

    /**
     * Rigourous Test :-)
     */

    /**
     * Runs a simple test verifying the title of the amazon.com homepage.
     * @throws Exception
     */
    @org.junit.Test
    public void testApp() {
        driver.get("http://www.keepgo.com/pages/landing2");
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[1]/h1")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[1]/h2")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[1]/h2")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/h1[1]")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[3]/div[1]/p")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[3]/div[2]/p")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[3]/div[3]/p")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[3]/div[4]/p")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[3]/div[2]")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[3]/div[4]")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[4]/div[1]")));
        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div[4]/div[1]")));

        driver.findElement(By.xpath("/html/body/div[3]/div[1]/div[4]/div[2]/a[2]/div")).click();        // click on the button "Learn More " under "Lifetime Data SIM Card" field

//        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div/div/div[1]/div[1]/div[1]/div[1]/div/div[2]/img")));
//        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div/div/div[1]/div[1]/div[1]/a[1]")));
//        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div/div/div[1]/div[1]/div[1]/a[2]")));
//        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div/div/div[1]/h1")));
//        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div/div/div[1]/div[2]/div[1]/div/div[2]/form[2]/input[2]")));
//        assertTrue(isElementPresent(By.xpath("/html/body/div[3]/div[1]/div/div/div[1]/div[2]/div[1]/div/div[2]/form[1]/input[2]")));
//        assertTrue(isElementPresent(By.className("image-colection")));
//        assertTrue(isElementPresent(By.className("row")));
//        assertTrue(isElementPresent(By.className("price-box")));
//        assertTrue(isElementPresent(By.className("link-to-reviews")));
//        assertTrue(isElementPresent(By.className("description")));
//
//        ((JavascriptExecutor) driver).executeScript("scroll(0,500)");
//
//        assertTrue(isElementPresent(By.className("coverage")));
//        assertTrue(isElementPresent(By.xpath("clearfix")));
//
//        driver.findElement(By.className("yotpo-default-button yotpo-icon-btn pull-right yotpo-hidden-mobile write-button write-review-button")).click();   // write a review
//        driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div[1]/div[3]/div/div/div[2]/div/div[2]/div/div[1]/input")).sendKeys("Sample");      // title
//        driver.findElement(By.xpath("y-input yotpo-text-box")).sendKeys("Sample");                                                      // put smth into the review field
//        driver.findElement(By.xpath("/html/body/div[3]/div[1]/div/div/div[1]/div[3]/div/div/div[2]/div/input")).click();                // click on the Post button


        driver.quit();
    }


    private boolean isElementPresent(By by) {
        try {
            driver.findElement(by);
            return true;
        } catch (NoSuchElementException e) {
            return false;
        }
    }

    /**
     *
     * @return the value of the Sauce Job id.
     */
    @Override
    public String getSessionId() {
        return sessionId;
    }
}

Обратил внимание на следующий вывод в консоле:


[WARNING] /C:/.../testForKeepGo/src/test/java/com/company/AppTest.java: C:\Users\...\TestForKeepGo\src\test\java\com\company\AppTest.java uses unchecked or unsafe operations.
[WARNING] /C:/Users/.../TestForKeepGo/src/test/java/com/company/AppTest.java: Recompile with -Xlint:unchecked for details.

Может кто-то знаком с такого рода ошибками?