“OsProcess checkForError : CreateProcess error=193, %1 is not a valid Win32 application” while starting Internet Explorer through Java and Selenium

This error message…

org.openqa.selenium.os.OsProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "C:\Users\emorales\Documents\MicrosoftWebDriver.exe" (in directory "."): CreateProcess error=193, %1 is not a valid Win32 application)

…implies that the underlying OS was unable to initiate/spawn a new WebBrowsering session i.e. Internet Explorer Browser session.

As per your code trial you are trying to cast the WebDriver instance i.e. driver to InternetExplorerDriver(), so within the line System.setProperty() you need to provide the absolute path of the respective IEDriverServer binary (but not MicrosoftWebDriver.exe).

You can download the relevent IEDriverServer binary version from the Index Page and mention in your code as:

System.setProperty("webdriver.ie.driver", "C:\\path\\to\\IEDriverServer.exe");
//set webdriver to explorer  test
WebDriver driver = new InternetExplorerDriver();

//metodo para obtener url
driver.get("http://google.com");

System.out.println(driver.getTitle());

Leave a Comment