Как устранить ошибку "пакет org.openqa.selenium.winium не существует"?

Я использую инструмент Winium для автоматизации. Я включил ниже jar-файлы в classpath моего проекта,

  1. Селен-сервер автономный-3.14.0.jar
  2. TestNG-7.0.0-beta1.jar
  3. winium-элементов рабочего стола-0.1.0-1.jar
  4. winium-элементов рабочего стола-0.2.0-1.jar

Java установленная версия: 1.8

Когда я пытаюсь скомпилировать программу, я получаю ошибки ниже.

D:\Incidents\Winium_213716\TestProjects\winium-desktop-sample-project-master\winium-desktop-sample-project-master\src\main\java>javac sampleTest.java
sampleTest.java:44: error: package org.openqa.selenium.winium does not exist
import org.openqa.selenium.winium.DesktopOptions;
                             ^
sampleTest.java:45: error: package org.openqa.selenium.winium does not exist
import org.openqa.selenium.winium.WiniumDriver;
                             ^
sampleTest.java:52: error: cannot find symbol
DesktopOptions options= new DesktopOptions();
^
symbol:   class DesktopOptions
location: class sampleTest
sampleTest.java:52: error: cannot find symbol
DesktopOptions options= new DesktopOptions();
                          ^
symbol:   class DesktopOptions
location: class sampleTest
sampleTest.java:55: error: cannot find symbol
WiniumDriver driver=new WiniumDriver(new 
URL("http://localhost:9999"),options);
  ^
symbol:   class WiniumDriver
location: class sampleTest
sampleTest.java:55: error: cannot find symbol
WiniumDriver driver=new WiniumDriver(new 
URL("http://localhost:9999"),options);
                       ^
symbol:   class WiniumDriver
location: class sampleTest
6 errors

Ниже мой код Java

import java.io.IOException;
import java.net.URL;
import org.openqa.selenium.winium.DesktopOptions;
import org.openqa.selenium.winium.WiniumDriver;
import org.testng.annotations.Test;

public class sampleTest 
{
 @Test
 public void test() throws IOException{
 DesktopOptions options= new DesktopOptions();
 options.setApplicationPath("C:\\WINDOWS\\system32\\notepad.exe");
  try{
  WiniumDriver driver=new WiniumDriver(new 
  URL("http://localhost:9999"),options);
  driver.findElementByClassName("Edit").sendKeys("This is 
 sample test");
  driver.close();
 }
 catch(Exception e){
 System.out.println(e.getMessage());
}
}

1 ответ

Вам нужен Winium JAR веб-драйвер для упомянутых импортов

Winium -webdriver-0.1.0-1-sources.jar Этот файл jar является обязательным. Он содержит только пакет org.openqa.selenium.winium, который отсутствует в вашем случае.

Попробуйте добавить его как зависимость maven, если это проект maven, или найдите указанную ниже зависимость в maven central и загрузите как zip. извлеките и добавьте в путь сборки вашего проекта => Путь сборки Java -> библиотеки.

<dependency>
    <groupId>com.github.2gis.winium</groupId>
    <artifactId>winium-webdriver</artifactId>
    <version>0.1.0-1</version>
</dependency>
Другие вопросы по тегам