Search code examples
seleniumselenium-webdrivertestng-eclipse

org.testng.TestNGException: Cannot instantiate class EDRTermsPackge.ContactInformationTesting


I"m trying to resolve this issue but to no avail. Here is my Source Code

public class ContactInformationTesting   {

    //Using or Launching Internet Explorer
    String exePath = "\\Users\\jj85274\\Desktop\\IEDriverServer.exe";

    //For use of IE only; Please enable for IE Browser
    WebDriver driver = new InternetExplorerDriver(); 




  @Test
  public void OpenPage_Login() {


        driver.get("http://cp-qa.harriscomputer.com/");
  }

Solution

  • You need to set the System property webdriver.ie.driver before instantiating the InternetExplorerDriver object. I could not find that in your code: Try following:

    System.setProperty("webdriver.ie.driver", "<path_to_your_IEDriverServer.exe>");
    WebDriver driver = new InternetExplorerDriver();
    

    Let me know, if you still get the same error.

    UPDATE: I have assumed that IEDriverServer.exe's local path is C:\Users\jj85274\Desktop\IEDriverServer.exe. You can change it, as per its location on your machine. Try following code and let me know, whether you are able to launch Internet Explorer successfully.

    System.setProperty("webdriver.ie.driver", "C:\\Users\\jj85274\\Desktop\\IEDriverServer.exe");
    WebDriver driver = new InternetExplorerDriver();