Unable to launch IE browser in selenium webdriver

Suraj picture Suraj · Jul 6, 2016 · Viewed 28.9k times · Source

I have written a sample code to launch IE browser and load google page.

public class Sample {

 public static void main(String[] args) 
  {
    // TODO Auto-generated method stub
    System.setProperty("webdriver.ie.driver","H:/IEDriverServer.exe");
    WebDriver driver=new InternetExplorerDriver();
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);

    driver.get("http://www.google.com");
  }
}

But when I run this script it launches browser and it gets closed immediately (less than 2 sec) without prompting any error and the script wont terminates.

This is what I can see on console screen:

Started InternetExplorerDriver server (32-bit)

2.53.1.0

Listening on port 46974

Only local connections are allowed

Can any one help me on this issue?

Answer

Sandeep picture Sandeep · Jul 6, 2016

Below steps are worked for me, Hope this will work for you as well:

  1. Open internet explorer.
  2. Navigate to Tools->Option
  3. Navigate to Security Tab
  4. Now for all option like Internet,Intranet,Trusted Sites and Restricted Site enable "Enable Protected" mode check-box.
  5. Set IE zoom level to 100%
  6. Click on Apply and OK
  7. Close the IE browser and run your script