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

问题描述 投票:0回答:1

我正在使用Winium工具进行自动化。我已将jar文件包含在我的项目的类路径中,

  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());
}
}
java selenium automation winium
1个回答
0
投票

您需要Winium web driver jar用于上述进口

© www.soinside.com 2019 - 2024. All rights reserved.