Winium driver throws error while trying to quit

1.5k views Asked by At

I'm trying to automate a windows based application using Winium-Eclipse. My code was executed successfully, but it throws error at the end line "driver.quit()". If I comment this line, no more errors were found. What should I do to quit the driver after execution.?

The error is Exception in thread "main" org.openqa.selenium.WebDriverException: Process has exited, so the requested information is not available. (WARNING: The server did not provide any stacktrace information)

Driver info: org.openqa.selenium.winium.WiniumDriver

I have attached a sample code for your reference which throws the same error.

package calc2;

import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.By;
import org.openqa.selenium.winium.DesktopOptions;
import org.openqa.selenium.winium.WiniumDriver;

public class TestCalc2 
{
 public static void main(String args[]) throws MalformedURLException, InterruptedException
 {
  DesktopOptions options = new DesktopOptions();
  options.setApplicationPath("C:\\Windows\\System32\\calc.exe");
  WiniumDriver driver = new WiniumDriver(new URL("http://localhost:9999"),options);
  Thread.sleep(3000);
  driver.findElementById("num8Button").click();
  driver.findElementById("plusButton").click();
  driver.findElementById("num9Button").click();
  driver.findElementById("equalButton").click();
  String output = driver.findElement(By.id("CalculatorResults")).getAttribute("Name");
  System.out.println("Result:"+output);
  driver.findElementById("Close").click();
  driver.quit();  
 }
}

1

There are 1 answers

2
Vijay On

Since you closed the application already by clicking on close button, driver cannot quit. Try commenting this line driver.findElementById("Close").click();