0

Использую Itelij IDEA. Подключил через maven junit 5.1 и selenium-server 3.9.1. Запускаю этот простенький тест:

@Test
public void searchTest() {
    WebElement searchField = driver.findElement(By.id("lst-ib"));
    searchField.sendKeys("Selenium");
    WebElement searchButton = driver.findElement(By.xpath("/html/body/div[1]/div[3]/form/div[2]/div[3]/center/input[1]"));
    searchButton.click();
    WebElement firstLink = driver.findElement(By.xpath("/html/body/div[6]/div[3]/div[10]/div[1]/div[2]/div/div[2]/div[2]/div/div/div/div[2]/div/div[1]/div/div/div[1]/div/div[1]/cite"));
    String link = firstLink.getText();
    Assertions.assertEquals(link,"https://ru.wikipedia.org/wiki/Selenium");
}

И выдает вот такое:

Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.commons.util.ReflectionUtils.getDefaultClassLoader()Ljava/lang/ClassLoader;
at org.junit.platform.launcher.core.ServiceLoaderTestEngineRegistry.loadTestEngines(ServiceLoaderTestEngineRegistry.java:31)
at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:42)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:36)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:262)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Process finished with exit code 1
Empty test suite.

Что я делаю не так?

1

1 ответ 1

0

Бросается в глаза, что вы не открываете страницу. Возможно драйвер поднимается в @Before, так? Сам текст ошибки выглядит так, как будь-то вы не собрали проект. Используете maven? Соберите проект с зависимостями и запустите тест сново

Ваш ответ

Нажимая на кнопку «Отправить ответ», вы соглашаетесь с нашими условиями использования и подтверждаете, что прочитали и поняли наши политику конфиденциальности и нормы поведения.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.