Search code examples
internet-explorerselenium-webdrivertestng-eclipse

CrossBrowser test with IE not working in testNG


I am trying to run a cross browser test in selenium using TestNG. It works fine in Firefox and Chrome, but not in IE. Script opens IE and on load, it points to URL - http://localhost:16189/ It doesn't navigate to base url.

Below is my config from testng.xml

<test name="IETest">

<parameter name="browser" value="IE" />

<classes>

<class name="crossbrowserpack.CrossBrowserScript">

</class>

</classes>

</test>

Below is the instance creation code for IE in my code.

if(browser.equalsIgnoreCase("ie")){
System.setProperty("webdriver.ie.driver","C:\\IEdriver.exe");
                //create IE instance
                driver = new InternetExplorerDriver();
            }

Below is my test method.

public void testParameterWithXML() throws InterruptedException{
        driver.get("http://newtours.demoaut.com");

Solution

  • pls cross check your version of internetexplorerdriver and IE instance you are trying to automate.

    Also add desired capabilities

    DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
    capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
    
    System.setProperty("webdriver.ie.driver", "C:\\IEDriverServer.exe");
    WebDriver driver = new InternetExplorerDriver(capabilities);
    

    Have you renamed IEDriverServer.exe to IEDriver.exe?