Thursday 27 October 2016

Selenium 3 Impact & Changes

Selenium is out with new stable version - Selenium 3.0.1, and this blog would detail out changes & impact the new version of Selenium brings into automation testing. 

Selenium 3, is believed to have major changes in its implementation & quite a few changes to the existing automation.In Sel-3, the original Selenium Core is being taken off & replaced with the alternative implementation that’s backed by WebDriver. It means, Selenium RC users would run into issues & might need to tweak their scripts to support new implementation. However, for web driver users it is believed to be a simple drop-in upgrade.


Along with Selenium 3 changes, Mozilla Firefox browser has brought changes in its internals which made the Selenium community provided firefox implementations to go vain. Hence, one has to use Mozilla provided geckodriver to support higher versions of Firefox.


Important Changes:

  1. Java 8 is must to work with Selenium 3.
  2. Mozilla’s ‘geckodriver’ needed to support higher versions of firefox [version 47.0.1 or later].
    [https://github.com/mozilla/geckodriver/releases]
  3. Firefox 47.0.0 is not supported for automation either with Sel -3 or Sel -2.
  4. Google Chrome continues to work as-is using chromedriver.
  5. Only IE 9 & above are supported.
  6. Support for Safari on MacOS (Sierra or later) via Apple’s own Safaridriver
    [https://github.com/SeleniumHQ/selenium/wiki/SafariDriver]
  7. Support for Edge is supported via Microsoft wedriver server.
    [https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/]
  8. Browser vendors [Google, Mozilla, Microsoft and Apple] ship their own implementations of drivers, which makes tight coupling between driver & browser for better testing.
  9. Small changes went into Selenium Grid, which needs config changes in json implemented Grid.

Code Changes to support Firefox using geckodriver:


To work with latest version on firefox using selenium 3, one has to set the system property ‘webdriver.gecko.driver’ similar to the chrome [webdriver.chrome.driver] & IE [webdriver.ie.driver].

However, the other implementation with firefox seems to be same as earlier selenium provided firefox driver. Refer below code snippet:

To create instance locally:


System.setProperty("webdriver.gecko.driver","pathtodriver\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.get("https://www.google.co.in");
System.out.println("Title: " + driver.getTitle());
driver.quit();


To create instance Remotely:

System.setProperty("webdriver.gecko.driver","pathtodriver\\geckodriver.exe");
DesiredCapabilities caps = DesiredCapabilities.firefox();
caps.setCapability("marionette", true);
WebDriver driver = new RemoteWebDriver(caps);
driver.get("https://www.google.co.in");
System.out.println("Title: " + driver.getTitle());
driver.quit();



Reference Links:
https://seleniumhq.wordpress.com
https://saucelabs.com/blog/selenium-3-is-coming

4 comments:

  1. I can vouch webdriver has proved the best feature in Selenium framework.
    Thanks a lot for taking a time to share a wonderful article. Selenium Training Course

    ReplyDelete
  2. Hi Shiva,

    You providing very useful contents, also helps to understand easily. Learned
    Selenium from your blog.

    ReplyDelete
  3. Thanks for providing the information . The articles in your blog helped me a lot for improving the knowledge on the subject. Also check my small collection on this at selenium Online Training blog

    ReplyDelete