I have written codes that works in Firefox. How do I get them to work in IE and CHrome without rewritting all. I learn’t there is an interface that can be implemented to do that. Help is greatly appreciated.



Train Asked on December 10, 2014 in Selenium WebDriver.
Add Comment
  • 1 Answer(s)
    Best answer

    Here I am writing 2 lines of code to execute all your scripts in both IE & Chrome.

    //System.setProperty(“webdriver.ie.driver”, “Path of your IE server exe file”);
    System.setProperty(“webdriver.ie.driver”, “D:/Drivers/InternetExplorerDriver.exe”);
    WebDriver driver=new InternetExplorerDriver();

    //System.setProperty(“webdriver.chrome.driver”, “Path of yourChrome server exe file”);
    System.setProperty(“webdriver.chrome.driver”, “D:/Drivers/ChromeDriver.exe”);
    WebDriver driver=new ChromeDriver();

    If you add these lines in your code instead of FirefoxDriver, its working fine.
    Thanks & Regards

    Train Answered on December 11, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.