首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何解决“包org.openqa.selenium.winium不存在”错误?

如何解决“包org.openqa.selenium.winium不存在”错误?
EN

Stack Overflow用户
提问于 2018-09-11 07:34:33
回答 2查看 1.6K关注 0票数 0

我使用的是自动控制工具。我已经将下面的jar文件包含在我的项目的类路径中,

  1. selenium-server-standalone-3.14.0.jar
  2. testng-7.0.0-beta1.jar
  3. winium-elements-desktop-0.1.0-1.jar
  4. winium-elements-desktop-0.2.0-1.jar

Java安装版本:1.8

当我试图编译程序时,我会遇到以下错误。

代码语言:javascript
复制
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代码

代码语言:javascript
复制
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());
}
}
EN

回答 2

Stack Overflow用户

发布于 2018-09-11 07:43:02

您需要用于上述导入的无线网络驱动程序 jar

票数 0
EN

Stack Overflow用户

发布于 2020-04-18 17:11:19

Wine-Webdriver-0.1.0-1-sources.jar. jar这个jar文件是必需的。这只包含包"org.openqa.selenium.winium“,这在您的情况下是缺失的。

如果这是一个maven项目,可以尝试将其作为maven依赖项添加,或者在maven中心搜索下面的依赖项,然后以zip的形式下载。提取并添加您的project=> ->库的构建路径。

代码语言:javascript
复制
<dependency>
    <groupId>com.github.2gis.winium</groupId>
    <artifactId>winium-webdriver</artifactId>
    <version>0.1.0-1</version>
</dependency>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52270909

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档