Not able to launch IE browser using Selenium2 (Webdriver) with Java

I'm not able to launch IE browser to run my selenium automated tests written in Java. I'm using Windows 7 and IE 9. Below is my code:

Please find the attachment.enter image description here

public class GoogleNews {
    private WebDriver driver;
    private String baseUrl;
    private StringBuffer verificationErrors = new StringBuffer();
    ArrayList al = new ArrayList();
    @Before
    public void setUp() throws Exception {
        //driver = new FirefoxDriver();
        driver =new InternetExplorerDriver();
        baseUrl = "https://news.google.co.in/";

    }

    @Test
    public void testApple() throws Exception {
        driver.get(baseUrl);
    }
}

Solution 1:

It needs to set same Security level in all zones. To do that follow the steps below:

  1. Open IE
  2. Go to Tools -> Internet Options -> Security
  3. Set all zones (Internet, Local intranet, Trusted sites, Restricted sites) to the same protected mode, enabled or disabled should not matter.

Finally, set Zoom level to 100% by right clicking on the gear located at the top right corner and enabling the status-bar. Default zoom level is now displayed at the lower right.

Solution 2:

Well as the stack trace says, you would need to set the protected mode settings to same for all zones in IE. Read the why here : http://jimevansmusic.blogspot.in/2012/08/youre-doing-it-wrong-protected-mode-and.html

and a quick how to from the same link : "In IE, from the Tools menu (or the gear icon in the toolbar in later versions), select "Internet options." Go to the Security tab. At the bottom of the dialog for each zone, you should see a check box labeled "Enable Protected Mode." Set the value of the check box to the same value, either checked or unchecked, for each zone"