Posts

Setting Chrome Driver for Selenium

import org.openqa.selenium.chrome.*; public class Test {     public static void main(String[] args) throws Exception     {         System.setProperty("webdriver.chrome.driver", "D:\\Dumps\\TestingTools\\chromedriver_win32\\chromedriver.exe");         ChromeDriver f=new ChromeDriver();         f.get("http://localhost/freshfruitnveg.in");         System.out.println(f.getTitle());         System.out.println(f.getCurrentUrl());         System.out.println(f.getPageSource());         f.quit();     } } URL to download gecko driver https://github.com/mozilla/geckodriver/releases URL to download chrome driver for Chrome 58+ http://chromedriver.storage.googleapis.com/index.html?path=2.28/

Setting Firefox Driver for Selenium

import org.openqa.selenium.firefox.*; public class Test {     public static void main(String[] args) throws Exception     {         System.setProperty("webdriver.gecko.driver", "D:\\Dumps\\TestingTools\\geckodriver-v0.20.0-win64\\geckodriver.exe");         FirefoxDriver f=new FirefoxDriver();         f.get("http://localhost/freshfruitnveg.in");         System.out.println(f.getTitle());         System.out.println(f.getCurrentUrl());         System.out.println(f.getPageSource());         f.quit();     } } URL to download gecko driver https://github.com/mozilla/geckodriver/releases URL to download Selenium Standalone Server JAR file https://www.seleniumhq.org/download/