System.setProperty("webdriver.firefox.marionette","D:\\selenium\\New folder\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://www.google.com/");
-
1are you getting any error?– IAmMilinPatelNov 28, 2016 at 7:30
2 Answers
Selenium recently launched its one of the major release, i.e., Selenium 3 – beta. You can download it from here- Download Selenium 3.0-Beta .
In this new version, one of the major change is the way Mozilla Firefox Browser is invoked and for that GeckoDriver is necessary for invoking Firefox Browser. Gecko Driver can be downloaded from Here.
The minimum version of Mozilla required for Selenium 3 is Firefox-48 and above.
System.setProperty("webdriver.gecko.driver","c://workspace//libs//geckodriver.exe");
WebDriver driver = new FirefoxDriver();
String url = "http://www.google.com";
/* To Maximize the window */
driver.manage().window().maximize();
/* To delete all the cookies of the browser */
driver.manage().deleteAllCookies();
/* To navigate to a particular URL */
driver.get(url);
This will definitely work..
If your using eclipse try switching the \\ to // in your path to the geckodriver. You also need to change the string inside the setProperty
to webdriver.gecko.driver
:
System.setProperty("webdriver.gecko.driver","D://selenium//New folder//geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.get("https://www.google.com/");
Also make sure that you have the correct version of firefox for the geckodriver.