1

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();  
 }
}
Harsha
  • 11
  • 2

1 Answers1

0

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

Vijay
  • 72
  • 12
  • Hello Vijay, I tried it as you mentioned. Commenting on close the application command would still throw an error "org.openqa.selenium.WebDriverException: Process has exited, so the requested information is not available. (WARNING: The server did not provide any stacktrace information)" – Harsha Nov 26 '18 at 06:10
  • Hi harsha,Driver Exited error will arise only when the application which the driver hold has no longer available or not on focus. I faced this error once, and for me removing the **close button click** worked. Not sure whether it is an focus issue. Try driver.quit without printing the output. – Vijay Nov 26 '18 at 11:38