Way to Selenium 3.0

 

Selenium 3 is on its way to be shipped. Simon Stewart (Selenium Project Lead) along with Applitools has given a sneak peek about Selenium3.0 on 25th May 2016. The Webinar was just great as all other presentations by Simon Stewart. I have identified few points and will try to summaries in this blog post-

Main aim for Selenium 3 is to be – “a tool for user-focused automation of mobile and web apps“. this one liner explains it all about Selenium 3 . So they are going to focus on automation of web and mobile apps only (No support for any other kind of application). For Selenium 3, They have primarily worked on making the technology behind Selenium as stable and capable as possible.

For understanding the changes happening in Selenium3, you really need to understand how selenium has been evolved since the time Selenium-Core was released. During this blog post, I will be going  through following points-

  1. The past of Selenium project – how it evolved
  2. Where is Selenium 3.0
  3. User visible changes
  4. Back-end changes

Evolution of Selenium  – Json huggins from throughworks has created a javascript test runner which was capable of injecting Javascript in html pages and perform the required action. User need to create their script in html which is not really a programming language. Due to JavaScript’s same origin policy, user was not able to perform action on the different domain (websites). Then RC came in picture, where your script can actually communicate to a proxy server(RC server) and trick your browser to believe that all the requests are coming from same domain. It was really hard to maintain the Selenium RC/Core tool for the Selenium developer, so they have started working on creating a standard api which can perform all action required on a web page irrespective of the language in which scripts are written.

Simon Stewart then discovered WebDriver api which works on JSON wire protocol over http, and don’t have any language specific dependency. Then this api was wrapped in to language specific bindings to support multiple languages and this was called Selenium 2.0

Where is Selenium 3 – There are two level changes; back-end level changes and user visible changes.

User visible changes

  1. Selenium Core would completely be removed.
  2. Selenium RC would be deprecated, there would be no active development to support Core or RC except the very urgent fixes.
  3. The RC api would be backed by WebDriver, so you can execute your existing RC script (WebDriver is recommended for all active development for new scritps)
  4. Client bindings for other languages except for JAVA are still same
  5. Using WebDriver after quit() would be now an illegal State Exception
  6. For mobile users, the Selenium 3 will be hosting a suite of tests to facilitate interoperability between the many different projects available (i.e. Appium, ios-driver, Selendroid etc.) that are extending the WebDriver API to also cope with mobile.
  7. New Java binding structure for Selenium3 is as follows-
  • Selenium – JAVA : just the webdriver classes
  • Selenium 3 server : Lighweight, command line compatible remote server
  • leg-rc : the old selenium client side classes, WebDriverBackedSelenium, Remote end point for Se3 server

As there would be no support for RC and core, existing scripts would be executed by leg-rc’s “WebDriverBackedSelenium”. Selenium RC server would be replaced by Selenium 3 server which would be command line compatible that means you can access its features through command line. it would really help in continuous integration. Selenium3 server might also have capability to hook in to already opened browser windows.

Backend level changes – Due to support for many browsers by Selenium 2.0 , it was really hard for developer to fix selenium specific issues. For example fixing an issue for one browser (chrome) trigger some other issue for different browser(Firefox). The reason for this inconsistency is that every browser follows different approaches for Xpath engines and other browser mechanism. So Selenium has come up with W3C standard and asked every browser owner to follow these standard while implementing browser. Selenium developer community has also recommended every browser vendor to own the drivers as they are more familiar with their browser. So apart from these following can be changes from back-end side-

  1. Migrate all drivers to use the status strings rather than status codes in responses
  2. All actions to have a single end point for JSON wire protocol service
  3. Migration to netty or webitt server

There is no changes in terms of additional features. They are targeting to have new features specific to mobile in Selenium 4.0. Selenium 5.0 would be completely W3C compatible. Selenium3 and Selenium4 would have interoperability i.e. client bindings of Selenium3 can communicate to Selenium 4 server and vice – versa.

If we look in terms of stability and back-end changes for Selenium , it is a big change. That is why they have changed a major version from 2.0 to 3.0

The old versions will still be available as a separate download, but active development will cease, except for very urgent fixes.

Hopefully , it would be available to download on official Selenium site. I hope i have covered all the features and points related to Selenium 3, feel free to add in comments if anything is missed. 🙂

EDIT 1 : For Q&A session with Simon Stewart during this webinar, please refer to comments of this blog post. 🙂

EDIT 2 : Selenium 3 beta is now officially released, please visit my latest blog – Selenium 3: Firefox with Gecko Driver

15 thoughts on “Way to Selenium 3.0

  1. Key question and answers from the webinar are listed below for reference 🙂

    • Is Selenium getting scaled up to automate Standalone / windows applications in version 3.0?
    o There is no plan to support windows applications
    o However, Appium, Selendroid, IOS driver extends the web driver API For mobile apps testing

    • What is the impact of Selenium 3.0 on existing Selenium Grid?
    o No impact as Remote implementation remained same
    o It may change from Selenium 3.0 to 4.0 but not from 2.0 to 3.0
    o Planned to support the backward compatible when moving from 3.0 to 4.0 to mitigate the impact

    • How does Selenium support the popular library, ReactJS?
    o ReactJS uses memory to build Virtual DOM which in turn modifies the html DOM
    o Selenium offers the WebDriver as building blocks
    o ReactJS team need to support by extending their APIs leveraging Selenium web Driver
    o Same is applied for other libraries like Jquery, AngularJS, etc.,

    • Any document, guidelines available to go about with the new language bindings?
    o Available on a wiki page in GitHub Selenium

    Like

    • Hey Anuj, you might be looking for differences between W3C Webdriver specs and Json wire protocol. Webdriver wire and Json wire both are same protocol, its just a short form of calling it. Its complete name is Webdriver json wire protocol. Please find detailed comparison below

      WebDriver Json wire protocol – All webdriver implementation which communicates to the browser uses a common protocol, where all commands(browser actions) are executed by sending a JSON request over HTTP using RestFull web services. This is going to be obselete when new W3C standard would be implemented by Selenium

      W3C specs – After Selenium become too popular, “Browser Testing and Tools Working Group” decided to write few standards which selenium should implement to provide easy cross browser support and interacting the dom. Therefore browser vendors has also took initiative to follow these standards when designing browser drivers. So you might have heard the new that now Safari and Edge has offcial WebDriver support. As said by Simon, Selenium 5.0 would have all W3C standard implemented.

      Current status for W3C can be found at – https://w3c.github.io/webdriver/webdriver-spec.html

      Like

    • Hey Giang,

      When you download and use selenium 3 with java, its not like you have to download three different packages or something. Its just that they have done this to make their code structure more organized amd in meaningful manner.
      They have structured it in following way-
      1. whole webdriver code(i.e. webdriver java)
      2. code which provides backward compatibility (i.e. leg rc)
      3. selenium standalonr server ( selenium remote server with additional command line capability)

      So it will be now easy for developers to fix bugs in new webdriver without affecting other old pieces of tool

      I hope I make sense..
      Thanks
      Gaurav

      Like

  2. Thank you for explaining Gaurav.
    There are some points in this article i am still not clear yet. could you help me on these.
    First, “Selenium3 would really help in continuous integration”. Could you explain the howto and give some example command?

    Final, “Selenium3 server might also have capability to hook in to already opened browser windows.” It’s new! How can you do that? Can you give an example?

    Liked by 1 person

    • Hey Giang,

      Please find my comment below for both statement-

      “Selenium3 would really help in continuous integration” – Continuous integration is more streamline if you have lots of command line options e.g. mvn test -Dusername= “something” … And as discussed Selenium3 server’s features can be accessed through command line as well. So based on that statement, I concur that it will help in continuous integration if there would be any need to handle Selenium3 server from command line.

      “Selenium3 server might also have capability to hook in to already opened browser windows.” – This is not available yet, and it is not either confirmed that this feature would be available. Due to lot of demand of this feature, He said that their team might look in to its solution.

      I hope my explanation make sense to you.

      Thanks
      Gaurav Tiwari

      Like

  3. It is very helpful for me Gaurav. Thanks.
    Since the Simon Stewart’s speech have been made in 25th May 2016. Are those things still available when Selenium 3 just released? Is there any new Gaurav?

    Like

    • Hey Matt,

      1. Gecko driver is designed to support Firefox version>47.0.1
      2. If you are using Firefox -47.0.2, you will have to use Selenium 3 + Geckodriver
      3. If you are using Selenium2 and Firefox version <47.0.2, then there is no need of Geckodriver
      4. Selenium3+ Firefox<47.0.2 will also work , but you would be needed geckodriver (because Selenium 3 has coded in such a way that it will need gecko for Firefox irrespective of Firefox version)

      So geckodriver is primarily designed to support Firefox W3C compatibility with version greater then 47.0.1

      I hope this answer your question.

      Thanks
      Gaurav Tiwari

      Like

Leave a comment