0

I am trying to execute the selenium web driver script in IE browser but I got this error? can any one provide the solution.

Code :

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
public class demo3 {
 public static void main(String[] args) {
 // TODO Auto-generated method stub
 System.setProperty("webdriver.ie.driver", "C:\\work\\MicrosoftWebDriver.exe");
 WebDriver driver= new InternetExplorerDriver(); 
 driver.get("http://www.msn.com");
 System.out.println(driver.getTitle());
 System.out.println(driver.getCurrentUrl());
 }
}

Getting Error in console and have also attached the screenshot :

Aug 12, 2018 8:52:17 PM 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:\work\MicrosoftWebDriver.exe" (in directory "."): CreateProcess error=193, %1 is not a valid Win32 application) Exception in thread "main" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:32:14.902Z' System info: host: 'GITANJALI-PC', ip: '192.168.0.12', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '10.0.2' Driver info: driver.version: InternetExplorerDriver at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:193) at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:179) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212) at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:221) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:213) at org.openqa.selenium.ie.InternetExplorerDriver.(InternetExplorerDriver.java:150) at demo3.main(demo3.java:10) Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:42885/status] to be available after 20007 ms at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100) at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:188) ... 8 more Caused by: java.util.concurrent.TimeoutException at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204) at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156) at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75) ... 9 more

Bharat Mane
6,78512 gold badges42 silver badges69 bronze badges
asked Aug 12, 2018 at 16:54
2
  • can you please edit it a bit so that we can read it? Commented Aug 12, 2018 at 21:26
  • You probably are trying to run the application compiled for 64-bit Windows under 32-bit Windows. Commented Aug 13, 2018 at 10:00

2 Answers 2

2

MicrosoftWebDriver.exe is the Edge driver, not IE driver. As others have mentioned the IE driver is called IEDriverServer.exe.

As an example of a launcher for IE:

System.setProperty("webdriver.ie.driver", "C:\\DriverFiles\\IE\\x32\\IEDriverServer.exe");
// custom stuff IE needs in order to work (some only needed for Win10+)
DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
ieCapabilities.setCapability("nativeEvents", false);
ieCapabilities.setCapability("unexpectedAlertBehaviour", "accept");
ieCapabilities.setCapability("ignoreProtectedModeSettings", true);
ieCapabilities.setCapability("disable-popup-blocking", true);
ieCapabilities.setCapability("enablePersistentHover", true);
ieCapabilities.setCapability("ignoreZoomSetting", true);
// deprecated but working
driver = new InternetExplorerDriver(ieCapabilities);
// Set browser defaults (maximise, clear cookies, set timeouts)
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
answered Dec 6, 2019 at 16:11
1
  • Thank you so much :) Commented Jan 13, 2021 at 9:10
1

Change the following line as

 System.setProperty("webdriver.ie.driver", "C:\\work\\IEDriverServer.exe");

The file name is IEDriverServer.exe and not MicrosoftWebDriver.exe. Check the path for IE driver.

answered Aug 13, 2018 at 5:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.