Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open specific browser using Selenium webdriver

I am using lang :java framework: testNG

my system has 3-4 versions of Mozilla installed, how can i open instance of specific version of Mozilla. Suppose i have 3.5, 3.6,.... version of Mozilla installed and I want to open 3.6 version and perform my testing.

like image 702
Shammi Avatar asked Jun 08 '13 10:06

Shammi


3 Answers

Just specify the path to the binary of the version..may be, like-

FirefoxBinary binary = new FirefoxBinary(new File("path_to_bin"));
FirefoxProfile profile = new FirefoxProfile();
WebDriver driver = new FirefoxDriver(binary, profile);
like image 150
Ishank Avatar answered Nov 05 '22 10:11

Ishank


Just assign a path to proper version of firefox.exe to webdriver.firefox.bin property.

System.setProperty("webdriver.firefox.bin", "c:\\path\\to\\firefox.exe");
like image 35
JacekM Avatar answered Nov 05 '22 10:11

JacekM


For firefox

 System.setProperty("webdriver.gecko.driver","path of geckodriver.exe");
 WebDriver driver = new FirefoxDriver();

Fro Chrome browser

     File file = new File("D:\\selnium webdriver\\driver\\chromedriver.exe");
     System.setProperty("webdriver.chrome.driver", file.getAbsolutePath() );
      WebDriver driver = new ChromeDriver();

For Internet explorer

           File file = new File("D:\\selnium webdriver\\driver\\IEDriverServer.exe");
    System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
       WebDriver driver = new InternetExplorerDriver();
like image 20
Ankit jain Avatar answered Nov 05 '22 10:11

Ankit jain