Java – How to run webdriver script on firefox, chrome and IE parallaly in IntellijIdea

intellij-idea, java, junit4, selenium-webdriver

I have created a framework in IntellijIdea for some simple functionality like Google Search, Gmail Registration and Gmail Login.
I tried to run my script on IE, chrome and firefox separately. It is working fine.
Now I want to run the script on all above browsers parallel y.
Can anyone help me to write a piece of code for the same???
Thanks in advance.

Best Solution

    @Testpublic void test() throws Exception{    WebDriver fireFoxDriver = null;    WebDriver chromeDriver = null;    WebDriver internetExplorerDriver = null;    //FireFox Driver        fireFoxDriver = new FirefoxDriver();        fireFoxDriver.get("http://yahoo.com");        System.out.println("Firefox Windows Title = " + fireFoxDriver.getTitle());        //Chrome Driver        System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir") + "\\chromedriver.exe" );        chromeDriver = new ChromeDriver();        chromeDriver.get("http://gmail.com");        System.out.println("Chrome Windows Title = " + chromeDriver.getTitle());        //IE Driver. NOTE: Turn off the protected mode for all Zones ( Internet / Local intranet / Trusted Sites / Restricted Sites ) or else the browser fails to launch        System.setProperty("webdriver.ie.driver", System.getProperty("user.dir") + "\\IEDriverServer.exe");        //Without the following two lines of code I was getting the following exception on Windows 7 & IE 9:        //org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Browser zoom level was set to 79%. It should be set to 100% (WARNING: The server did not provide any stacktrace information)         DesiredCapabilities caps = DesiredCapabilities.internetExplorer();         caps.setCapability("ignoreZoomSetting", true);        internetExplorerDriver = new InternetExplorerDriver(caps);        internetExplorerDriver.manage().window().maximize();        internetExplorerDriver.get("http://nseindia.com");        System.out.println("IE Windows title = " + internetExplorerDriver.getTitle());        internetExplorerDriver.quit();        fireFoxDriver.quit();chromeDriver.quit();}