0

I am using Winium tool for automation. I have included below jar files into the classpath of my project,

  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 installed version : 1.8

When I try to compile the program, I am getting below errors.

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

Below is my java Code

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());
}
}
Praveen
  • 1,791
  • 3
  • 20
  • 33

2 Answers2

0

You need Winium web driver jar for the mentioned imports

Praveen
  • 1,791
  • 3
  • 20
  • 33
  • Thanks for your answer. I have included Winium web driver. But that has not resolved my errors. – Shobika Palani Sep 11 '18 at 08:37
  • @ShobikaPalani Do you mean you are still getting the compilation errors? – Praveen Sep 11 '18 at 08:53
  • I have been including the jar files by setting the classpath via Command Line as like below set classpath=%CLASSPATH%; D:\Incidents\Winium_213716\TestProjects\jars\*.jar Is this correct? – Shobika Palani Sep 11 '18 at 09:18
  • I am not sure if you can set classpath like that. You can try like [this](https://stackoverflow.com/questions/22965975/how-to-set-up-classpath-of-javacompiler-to-multiple-jar-files-using-wildcard) which sets up the classpath using wildcards in `javac` – Praveen Sep 11 '18 at 12:21
0

winium-webdriver-0.1.0-1-sources.jar This jar file is required. This only contains the package "org.openqa.selenium.winium" which is missing in your case.

Try adding it as maven dependency if this is a maven project or search for the below dependency in maven central and download as zip. extract and add to build path of your project=> Java build path -> libraries.

<dependency>
    <groupId>com.github.2gis.winium</groupId>
    <artifactId>winium-webdriver</artifactId>
    <version>0.1.0-1</version>
</dependency>
Maddy
  • 29
  • 6