Sign up ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

I am new to selenium webdriver and by default when i run a script it is opening a session in Firefox. now i want to open this session in other browsers like Google Chrome, IE.

How can i open this sessions?

Thanks Kamlesh

share|improve this question

3 Answers 3

To create an instance of a browser when running WebDriver test you need to create an a driver specific to that browser. Firefox works by default, but to work with other browsers such as chrome you may have to download the driver separately.

This is website will give you information on how to install the chrome driver and how to get it running.

You will need to have chrome install on your test machine as well. Other drivers for other browsers can be install in the same manner.

share|improve this answer
    package mercuryreg;
    import java.util.regex.Pattern;
    import java.util.concurrent.TimeUnit;
    import org.junit.*;
    import static org.junit.Assert.*;
    import static org.hamcrest.CoreMatchers.*;  
    import org.openqa.selenium.*;
    import org.openqa.selenium.firefox.FirefoxDriver;
    import com.thoughtworks.selenium.webdriven.commands.IsElementPresent;

    public class MercuryReg {

      public void mMercuryReg() throws Exception {

          System.setProperty("", "E:\\Softwares_Must_Have\\sele\\chromedriver\\chromedriver.exe");

            WebDriver driver = new ChromeDriver(); 

            //Open Home Page
            //Enter text in search box
            WebElement fname=driver.findElement("firstName"));

share|improve this answer
It would help if you explained what your code is doing to open the session in different browsers instead of just pasting code. That will make your answer useful to anyone looking for this information. – Kate Paulk Jul 15 '14 at 10:59
System.setProperty("", "E:\\Softwares_Must_Have\\sele\\chromedriver\\chromedriver.exe");
     WebDriver driver = new ChromeDriver(); 

this is the syntax to locate the third party driver,. you have to download the driver. then you have to initiate and call it..

thanks Prakash and am new to stackexchange..

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.