Selenium 3 All that you should know about it

Selenium 3 All that you should know about it

For months, since the Selenium 3.0 had launched I had avoided using it because all  I could think of was the huge effort it would have taken me to rebuild my projects, retest my working automation suites and the nightmare of seeing the failures after successfully being marked as pass. And I just kept avoiding accepting the change even though it was for the better. I believe that’s human nature.

So I chose to work with Selenium 2.53 version and firefox 46.0 version as it was the last supported version with selenium. The word geckodriver made me nauseous, I mean who choses a word like gecko it has this eerie feeling to it, don’t you think so? For some reason it kept me reminding of the character ‘Gollum’ from the Lord of the rings.

Selenium 3.0 – All that you should know about it

My version of GeckoDriver

Yeah I hope you will now understand my fears!! I was soon to find out, that it was all baseless and irrational, like any fear is, specially the fear of unknown.

Understanding Selenium 3.0

So one fine day, I decided to face it head off and to get over it. I sipped my ‘Dew’ which has a slogan ‘darr kea age jeet hai’ for those who don’t know hindi it means  – ‘once you overcome fear you are bound to succeed’. So before we move ahead to understand what all changes are required to made at the script level, we should look at a few terms

Gecko

Gecko is a web browser engine used in many applications developed by Mozilla foundation as well as in many other open source software projects.  It’s a free open source software subject to the term of

Mozilla Public License version.  So basically all the new versions of firefox are now built using the Gecko platform. The icon of it is as follows –

And needless to say I am not a big fan of lizards, I wonder from where these people get their inspirations. Jokes apart, now let us understand the other weirdly sounding name, though it has a musical touch to it.  To know more about it go to this link – https://en.wikipedia.org/wiki/Gecko_(software)

 

Marionette

If you want you can directly go to this link-  ­https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette or read a shorter version of it here.  It is an automation driver for Mozilla Gecko engine.  It can remotely control the UI and the internal java script of the firefox browser and other browsers built on the gecko platform. Its behavior is similar to that of the Selenium Webdriver.  It consists of two parts: A server which takes requests and executes them in Gecko, and a client, which sends commands to the server and the server executes the command inside the browser.

Gecko Driver

Gecko driver is basically software which forms a bridge between our browser firefox and the selenium. It can be downloaded from here – https://github.com/mozilla/geckodriver/releases, and we must upgrade to the Selenium 3.3 libraries for the language client to use them in our test script.

Implementation

To understand the implementation of the Selenium 3.0 we will be using the following environment –

Steps To Follow

  1. Download the gecko driver and extract its .exe file.- https://github.com/mozilla/geckodriver/releases
  2.      2. Download and add the Selenium Java 3.3.1 client libraries to the project workspace. You can get those files from this link – http://www.seleniumhq.org/download/
  3. We need to now use the gecko driver and pass it path to set a system property, the code for the same is as follows-

@Before

public void setUp() throws Exception {

System.setProperty(“webdriver.gecko.driver”,”D:\BUSINESS5 ELEMENTS LEARNINGSELENIUM WEBDRIVER//DRIVERgeckogeckodriver.exe”);

driver = new FirefoxDriver();

baseUrl = “http://5elementslearning.com/”;

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

}

This is all. In just three simple steps your tests will now run using Selenium 3.0 versions and geckodriver.

 

Conclusion

Needless to say, the gecko driver appears to me as a friendly ET whom I was afraid for no reasons.  It is fun to watch all the tests upgraded to the latest selenium version and working seamlessly.

No comments

Leave a reply

Your email is never published nor shared. Required fields are marked *