Sunday, 8 February 2015

GEB-Page Object Modelling with Power Of Selenium WebDriver and Groovy's expressiveness

                            
Agenda of this Blog: Introduction of GEB as a Solution of Browser Automation.

What is GEB: GEB is browser automation solution,which is a wrapper over Selenium WebDriver. It uses:


1. groovy's expressiveness to deal with the Browser Automation.
2. JQuery to deal with the WebElements.
3. Robust Page Object Modelling  Framework.

It can be Integrated with different Unit Test Framework such as JUnit,TestNg,Spock as well as different build tools like Maven,Gradle and CI tool like Jenkins.

Is it Really Useful when we have Selenium for Automation :
The answer to the above is YES, because it comes with few very good features along with it.

1. GEB uses Groovy language which itself is very powerful having features like Closure, GroovyMarkup and GPath support,dynamic and static typing is supported and many more.
2.As it is supported by Groovy,so less coding is required to write automation scripts compared to JAVA.
3. GEB supports JQuery to handle WebElements,so Scripts become more faster.
4.Asynchronous Content Lookup.
5.Selenium API can be used easily if need arises.

Structure of  Framework:

If we are using GEB then generally we follow 3 main building blocks of it:
1.Module:Where we keep our WebElements/Locators/JQuery Contents as static contents.
2.Pages:Place for the re-usable methods of Page/Module functionalities .
3.Specs: Where the Test Classes are kept.

Please refer the below screenshot for the Core framework structure.






Sample of Module given below:




Sample for Page :




GEB provides few methods like "at" which is used to verify whether we are on the stated page or not and "to" method to redirect the driver to the stated page.
If we are in certain page then to access the reusable methods of that page class i.e Page Functionalities we Don't need to create Object for that class,we can simple call the method.

Sample of a Test method :




Geb can be very effective and robust as a solution to the browser Automation.



Visit for More Automation Related Discussion:

https://www.youtube.com/channel/UCKSk4gkmO3LXcW17hFUkmcQ/videos


3 comments:

  1. Great things you’ve always shared with us. Just keep writing this kind of posts.The time which was wasted in traveling for tuition now it can be used for studies.Thanks automation

    ReplyDelete