Saturday 2 January 2016

How to launch Mozilla or Chrome after setting System Property



Launch mozilla after set the system property


System.setProperty("WebDriver.firefox.bin", "<C:<\\Programfiles\\Mozilla Firefox\\firefox.exe>>");
FirefoxBinary binary = new FirefoxBinary(new File("C:/Program Files/Mozilla Firefox/firefox.exe"));
FirefoxProfile profile = new FirefoxProfile();






Launch the chrome after set below system property

System.setProperty("webdriver.chrome.driver", System.getProperty("user.dir")+"\\chromedriver.exe");
log.info("Selected browser is Chrome browser");

DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability("chrome.binary", "/usr/lib/chromium-browser/chromium-browser");

driver1 = new ChromeDriver(capabilities);

No comments:

Post a Comment