我使用的是自动控制工具。我已经将下面的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());
}
}发布于 2018-09-11 07:43:02
您需要用于上述导入的无线网络驱动程序 jar
发布于 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=> ->库的构建路径。
<dependency>
<groupId>com.github.2gis.winium</groupId>
<artifactId>winium-webdriver</artifactId>
<version>0.1.0-1</version>
</dependency>https://stackoverflow.com/questions/52270909
复制相似问题