Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99397

How to initialize Selenium driver for default web browser and os

$
0
0

In my program, We are creating selenium webdriver for firefox with linux operating system. I wanted to know if there is any way you can create the driver which will initalize for the default operating system and web browser.

   protected static WebDriver driver = init();



private static WebDriver init()
   {
      DesiredCapabilities capability = DesiredCapabilities.firefox(); // I want 
to detect the default browser of OS
      capability.setPlatform(Platform.LINUX);//it should automatically find the OS.

  WebDriver driver = init(BrowserType.FIREFOX);//Same here for initializing default web browser.

  driver.manage()
        .deleteAllCookies();
  driver.manage()
        .timeouts()
        .pageLoadTimeout(50, TimeUnit.SECONDS);
  driver.manage()
        .timeouts()
        .implicitlyWait(10, TimeUnit.SECONDS);
  driver.manage()
        .window()
        .maximize();
  return driver;

}


Viewing all articles
Browse latest Browse all 99397

Trending Articles