SlideShare a Scribd company logo
Web Automation using Groovy, WebDriver,
     JQuery and Page Object Model


                        By: Gaurav Bansal
Need…
• We need a solution that is based on technology
  that is native to WebBrowsers.
• We need a solution that requires no boilerplate
  code.
• We need a solution that offers a powerful set of
  tools for matching a set of elements in a
  document.
• We need a solution that offers in-built
  mechanism to incorporate Page-object model
Solution…




  GEB
What is Geb?
• Geb is a browser automation solution.
• You can use it for…
  – Acceptance Testing Web Applications
  – Automating Web Sites
  – Screen Scraping
• It brings together the…
  –   Cross browser automation capabilities of WebDriver
  –   Elegance of jQuery content selection
  –   Expressiveness of the Groovy language
  –   Robustness of Page Object modelling
About the Project
• Free Open Source, Apache License, Version
  2.0.
• Currently at version 0.7.0.
  – Home Page — http://www.gebish.org
  – The Book of Geb — http://www.gebish.org
    /manual/current
  – Source Code — https://github.com/geb/geb
  – User Mailing List — http://
    xircles.codehaus.org/projects/geb/lists
  – In Maven Central — http://
    mvnrepository.com/artifact/org.codehaus.geb
Project Components
• The heart is the geb-core component which is
  all you really need (plus WebDriver).
• For testing, you probably also want one of these
  as well:
  –   geb-spock
  –   geb-junit3
  –   geb-junit4
  –   geb-testng
  –   geb-easyb
• (Has been used from Cucumber as well).
• There is also a Grails plugin.
WebDriver
             http://
seleniumhq.org/projects/webdriver/
WebDriver
•   Successor to the Selenium project.
•   Also known as “Selenium 2”.
•   Sponsored and driven by Google.
•   Becoming a W3C standard.
    – http://dvcs.w3.org/hg/webdriver/raw-
      file/515b648d58ff/webdriver-spec.html
Cross-browser
                           Automation
Java based, with many language bindings.
  import org.openqa.selenium.WebDriver; 
  import org.openqa.selenium.WebElement; 
  import org.openqa.selenium.By; 
  import org.openqa.selenium.firefox.FirefoxDriver; 

  WebDriver driver = new FirefoxDriver(); 
  driver.get("http://google.com"); 
  WebElement heading = driver.findElement(By.tagName("h1")); 
Mobile Browsers
• Rapidly improving.
  – iPad
  – iPhone
  – Android
  – Blackberry
• Can use real devices or emulators in most
  cases.
• A headless webkit based driver
  (PhantomJS) is in progress.
WebDriver API
• Geb sits on top of WebDriver so you very
  rarely deal with its API, though it's
  accessible if you need it.

• Geb never talks to the actual browser
  because that's what WebDriver does.
Driver dependency
• You need to pull in a specific driver
  implementation for each browser you want
  to work with.
  –   <dependency>
  –   <groupId>org.seleniumhq.selenium</groupId>
  –   <artifactId>selenium-firefox-driver</artifactId>
  –   <version>2.24.1</version>
  –   </dependency>
jQuery
http://jquery.com/
JQuery
• jQuery provides an incredibly powerful API
  for navigating and selecting content.
  – $("div#footer").prev().children();

  – CSS based, a whole lot better than XPath.
Geb's inspiration
• Geb features a “Navigator API” that is
  inspired by jQuery.

  – // This is Geb code, not jQuery JavaScript… $
    ("h1").previous().children();


• API is not identical.
Groovy
http://groovy-lang.org
Dynamic JVM Lang.
• Groovy is…
  – Compiled, never interpreted
  – Dynamic, optionally typed
  – 99% Java syntax compatible
  – Concise, clear and pragmatic
  – Great for DSLs
  – A comfortable Java alternative for most
Geb & Groovy
• Geb uses Groovy's dynamism to
  remove boilerplate.
 import geb.*
 Browser.drive {
      to GoogleHomePage
      at GoogleHomePage
      search.forTerm "wikipedia“
      at GoogleResultsPage 
      assert firstResultLink.text() == "Wikipedia" 
      firstResultLink.click()
      waitFor { at WikipediaPage }
      } 
Page Objects
 The key to not pulling your hair
out when dealing with web tests.
What are they?
•   In a phrase: Domain Modelling.

•   By modelling and creating abstractions, we can isolate implementation
    detail.

     $("input[name=username]").value("user")
     $("input[name=pwd]").value("password")
     $("input[type=submit]").click() 

•   Is far more fragile than this…

     void login(String username, String password) { 
            $("input[name=username]").value(username)
            $("input[name=pwd]").value(password)
            $("input[type=submit]").click()
     }

     login("user", "password") 
Just good programming
• It's the application of trusted principles;
  encapsulation and reuse.
• Not new at all, but new to the world of web
  testing/automation.
• Not just about modelling “pages”. It's
  about modelling all kinds of things in the
  domain of a user's actions online.
• Just giving symbolic names to page
  content is a great start.
Browser has-a Page
Browser.drive { 
     to GoogleHomePage 
     at GoogleHomePage 
     search.forTerm "wikipedia" 
     at GoogleResultsPage 
     assert firstResultLink.text() == "Wikipedia" 
     firstResultLink.click()
     waitFor { at WikipediaPage }
     } 


• The to() and click() methods are changing the
  underlying page.
• You can refer to the current page's content and
  methods just by name.
Geb's Page Objects
• Geb builds the Page Object pattern
  directly into the framework (though it is
  optional).
  import geb.*

  class GoogleHomePage extends Page { 
        static url = "http://google.com/ncr"  
        static at = { title == "Google" } 
        static content = { 
           search { module GoogleSearchModule }
        } 
  } 
Geb's Page Objects
• Features the “Content DSL” for naming
  content in a dynamic and powerful way.

  import geb.*
  class GoogleResultsPage extends Page { 
  static at = { waitFor { title.endsWith("Google Search") } }   
  static content = { 
          search { module GoogleSearchModule }  
          results { $("li.g") } 
          result { i -> results[i] }    
          resultLink { i -> result(i).find("a.l", 0) }
           firstResultLink { resultLink(0) }     } } 
Modules
• Modules are repeating and/or
  reappearing content.
 import geb.*
 class GoogleSearchModule extends Module {
     static content = {
         field { $("input", name: "q") } 
        button(to: GoogleResultsPage) { btnG() }
     }

    class StandardPage extends Page { 
         static content = {   gmod { module  GoogleSearchModule  }     } 
     } 
Testing
Geb's testing adapters
Geb for Testing
• Geb can be used with…
  –   Spock
  –   JUnit (3 & 4)
  –   TestNG
  –   EasyB
  –   Cucumber (Cuke4Duke)

• The majority of Geb users use Spock.
• Geb can dump HTML and screenshots for each
  “test” to help in debugging.
Navigator API
jQuery inspired content selection/
           navigation
The $() method
• Returns a Navigator object.
• General format:
  –$
   («css selector», «index/range», «attribute/text
    matchers»)


• Examples:
  – $("div") // all divs 
  – $("div", 0) // first div $("div", 0..2) // first three divs 
  – // The third section heading with text “Geb” $("h2", 2, id: "section", text: "Geb") 
CSS Selectors
• Full CSS3 if the target browser supports it.

  $("div.some-class p:first[title='something']")
  $("ul li a") $("table tr:nth-child(2n+1) td")
  $("div#content p:first-child::first-line") 



• CSS lookups are fast.
Attribute/Text match
• Can match on attribute values:
  – //<div foo="bar">
  – $("div", foo: "bar")

• The “text” attribute is special:
  – //<div>foo</div> 
  – $("div", text: "foo")

• Can use Regular Expressions:
  – //<div>foo</div> 
  – $("div", text: ~/f.+/) 
Predicates
• Geb supplies some handy predicates:

  $("p", text: startsWith("p")) 
  $("p", class: contains("section")) 
  $("p", id: endsWith(~/d/))
Relative Content
• $() returns a Navigator that allows you to find
  relative content.
   $("p").previous()
   $("p").prevAll()
   $("p").next()
   $("p").nextAll()
   $("p").parent()
   $("p").siblings()
   $("div").children() 

• Most of these methods take selectors, indexes
  and attribute text/matchers too.
  $("p").nextAll(".listing") 
Content DSL
Content DSL
class GoogleResultsPage extends Page {     
    static content = {
             results { $("li.g") }
             result { i -> results[i] }   
             resultLink { i -> result(i).find("a.l", 0) } 
             firstResultLink { resultLink(0) }     
     }
} 

• Content definitions can build upon each
  other.
• Content definitions are actually templates.
Optional Content
class OptionalPage extends Page {
    static content = { 
    errorMsg(required: false) { $("p.errorMsg") }
   }
 }

• By default, Geb will error if the content you
  select doesn't exist.
• The “required” option disables this check.
Dynamic Content
class DynamicPage extends Page {
     static content = { 
        errorMsg(wait: true) { $("p.errorMsg") }    
 }
}

• Geb will wait for some time for this content to
  appear.
• By default, it will look for it every 100ms for 5s
  before giving up. This is highly configurable.
• Same semantics as the waitFor {} method that
  can be used anywhere.
Expensive Content
class ExpensivePage extends Page { 
    static content = {  
       results(cache: true) { $("li.results") } 
       result { results[it] }    
 } 
} 


• By default, all content is transient.
• The cache option instructs Geb to hold on to the
  content, avoiding redundant lookups.
• Use carefully, can cause problems with dynamic
  pages.
Navigation
Getting around
The to() method
class GoogleHomePage extends Page { 
    static url = "http://google.com/ncr" 
}

• Pages can define a url that defines the
  page location.
• The to() method sends the browser there
  and sets that as the current page object.
• to GoogleHomePage The page url can be
  relative (will be resolved against a config
  driven base).
Content based navigation
class FrontPage { 
    static content = { 
    aboutUsLink(to: AboutUsPage) { $("div#nav ul li a", text: iStartsWith("About Us")) }    
      }
}

• When this content is clicked, the
  underlying page will be changed
  implicitly.
     to FrontPage
     aboutUsLink.click() 
     page instanceof AboutUsPage 
At Checking
• The “at checking” mechanism enables fail
  fast and less debugging.
class LoginPage extends Page { 
    static at = { $("h1").text() == "Please log in" }
 }

browser.at LoginPage 

• Will throw an exception if every statement
  of the at check is not true.
Driver Management
• Geb caches the WebDriver instance (per
  thread) and shares it across test cases.
• Manages clearing cookies and is
  configurable.
• This can be disabled and tuned.
Config. Management
• Looks for GebConfig class or GebConfig.groovy
  file (or class) on classpath.
  driver = { 
  new FirefoxDriver() 
  }

  waiting {
  timeout = 2 
  slow { timeout = 100 }
  } 

  reportsDir = "geb-reports“

  environments {
  chrome { driver = "chrome" }
  } 
What we didn't see
•   JavaScript interface
•   jQuery interface
•   Direct Downloading
•   Multi Window support
•   Frame support
•   Page Change Listening
•   Actions (e.g. Drag & Drop)
•   alert()/confirm() handling
Summary




JUnit3   Spock   Grails   JUnit4   EasyB
Thanks




         »       @gaurav_bansal
         »       gbansal@xebia.com /
           itsbansal@gmail.com
         »       +91-9899849992

More Related Content

What's hot

Jumpstart Django
Jumpstart DjangoJumpstart Django
Jumpstart Django
ryates
 
Echo HTML5
Echo HTML5Echo HTML5
Echo HTML5
Nathan Smith
 
Django
DjangoDjango
Django
Kangjin Jun
 
Django
DjangoDjango
Introduction to App Engine Development
Introduction to App Engine DevelopmentIntroduction to App Engine Development
Introduction to App Engine DevelopmentRon Reiter
 
Create responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSCreate responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJS
Hannes Hapke
 
Data Migrations in the App Engine Datastore
Data Migrations in the App Engine DatastoreData Migrations in the App Engine Datastore
Data Migrations in the App Engine Datastore
Ryan Morlok
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript DevelopmentJussi Pohjolainen
 
jQuery and_drupal
jQuery and_drupaljQuery and_drupal
jQuery and_drupal
BlackCatWeb
 
HTML5 JS APIs
HTML5 JS APIsHTML5 JS APIs
HTML5 JS APIs
Remy Sharp
 
Aligning Ember.js with Web Standards
Aligning Ember.js with Web StandardsAligning Ember.js with Web Standards
Aligning Ember.js with Web Standards
Matthew Beale
 
Why Django for Web Development
Why Django for Web DevelopmentWhy Django for Web Development
Why Django for Web Development
Morteza Zohoori Shoar
 
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJRealize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Leonardo Balter
 
HTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranHTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranRobert Nyman
 
API Design & Security in django
API Design & Security in djangoAPI Design & Security in django
API Design & Security in django
Tareque Hossain
 
Behavior Driven Development Testing (BDD)
Behavior Driven Development Testing (BDD)Behavior Driven Development Testing (BDD)
Behavior Driven Development Testing (BDD)
Dignitas Digital Pvt. Ltd.
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineYared Ayalew
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
Please dont touch-3.5
Please dont touch-3.5Please dont touch-3.5
Please dont touch-3.5
Francesco Fullone
 

What's hot (19)

Jumpstart Django
Jumpstart DjangoJumpstart Django
Jumpstart Django
 
Echo HTML5
Echo HTML5Echo HTML5
Echo HTML5
 
Django
DjangoDjango
Django
 
Django
DjangoDjango
Django
 
Introduction to App Engine Development
Introduction to App Engine DevelopmentIntroduction to App Engine Development
Introduction to App Engine Development
 
Create responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJSCreate responsive websites with Django, REST and AngularJS
Create responsive websites with Django, REST and AngularJS
 
Data Migrations in the App Engine Datastore
Data Migrations in the App Engine DatastoreData Migrations in the App Engine Datastore
Data Migrations in the App Engine Datastore
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript Development
 
jQuery and_drupal
jQuery and_drupaljQuery and_drupal
jQuery and_drupal
 
HTML5 JS APIs
HTML5 JS APIsHTML5 JS APIs
HTML5 JS APIs
 
Aligning Ember.js with Web Standards
Aligning Ember.js with Web StandardsAligning Ember.js with Web Standards
Aligning Ember.js with Web Standards
 
Why Django for Web Development
Why Django for Web DevelopmentWhy Django for Web Development
Why Django for Web Development
 
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJRealize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
 
HTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranHTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - Altran
 
API Design & Security in django
API Design & Security in djangoAPI Design & Security in django
API Design & Security in django
 
Behavior Driven Development Testing (BDD)
Behavior Driven Development Testing (BDD)Behavior Driven Development Testing (BDD)
Behavior Driven Development Testing (BDD)
 
GDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App EngineGDG Addis - An Introduction to Django and App Engine
GDG Addis - An Introduction to Django and App Engine
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
Please dont touch-3.5
Please dont touch-3.5Please dont touch-3.5
Please dont touch-3.5
 

Viewers also liked

Application Software
Application SoftwareApplication Software
Application SoftwareBeth
 
No one Deserves Lung Cancer
No one Deserves Lung CancerNo one Deserves Lung Cancer
No one Deserves Lung Cancer
Gabrielle Oliva
 
Profil wiraswasta Bapak Drs. Sajino
Profil wiraswasta Bapak Drs. SajinoProfil wiraswasta Bapak Drs. Sajino
Profil wiraswasta Bapak Drs. Sajinobangun93
 
Ad, Landscape Lights And Applications
Ad, Landscape Lights And ApplicationsAd, Landscape Lights And Applications
Ad, Landscape Lights And Applications
ledindex
 
La ruta de la sal 2013
La ruta de la sal 2013La ruta de la sal 2013
La ruta de la sal 2013Anam
 
Google themes
Google themesGoogle themes
Google themes
Alex Person
 
Afegir un client SNMP Ubuntu a Cacti
Afegir un client SNMP Ubuntu a CactiAfegir un client SNMP Ubuntu a Cacti
Afegir un client SNMP Ubuntu a Cacti
Jordi Clopés Esteban
 
Financial Crisis Coverage: NPR
Financial Crisis Coverage: NPRFinancial Crisis Coverage: NPR
Financial Crisis Coverage: NPREly Twiggs
 
Project in mapeh(bravo)
Project in mapeh(bravo)Project in mapeh(bravo)
Project in mapeh(bravo)Joyjoy Pena
 
Training Program Brief 2011
Training Program Brief 2011Training Program Brief 2011
Training Program Brief 2011spring7blue
 
Afp toronto 2010 11 f ire up your board for fundraising- easy jobs for every ...
Afp toronto 2010 11 f ire up your board for fundraising- easy jobs for every ...Afp toronto 2010 11 f ire up your board for fundraising- easy jobs for every ...
Afp toronto 2010 11 f ire up your board for fundraising- easy jobs for every ...gailperry
 
Ban borring words
Ban borring wordsBan borring words
Ban borring wordsKseniaNZ
 
Featuring my trip to Yunnan
Featuring my trip to YunnanFeaturing my trip to Yunnan
Featuring my trip to Yunnanjwolfie
 
Incontro mondiale delle famiglie 2012
Incontro mondiale delle famiglie 2012Incontro mondiale delle famiglie 2012
Incontro mondiale delle famiglie 2012
Roberto Flossi
 
Pr1 ri
Pr1 riPr1 ri
Pr1 ri
Anam
 
ソーシャルゲームのテクニックで “ゲーミフィケーション”を設計する.
ソーシャルゲームのテクニックで “ゲーミフィケーション”を設計する.ソーシャルゲームのテクニックで “ゲーミフィケーション”を設計する.
ソーシャルゲームのテクニックで “ゲーミフィケーション”を設計する.
Yuri Itou
 

Viewers also liked (20)

Application Software
Application SoftwareApplication Software
Application Software
 
No one Deserves Lung Cancer
No one Deserves Lung CancerNo one Deserves Lung Cancer
No one Deserves Lung Cancer
 
Book cristian araya
Book cristian arayaBook cristian araya
Book cristian araya
 
Profil wiraswasta Bapak Drs. Sajino
Profil wiraswasta Bapak Drs. SajinoProfil wiraswasta Bapak Drs. Sajino
Profil wiraswasta Bapak Drs. Sajino
 
Ad, Landscape Lights And Applications
Ad, Landscape Lights And ApplicationsAd, Landscape Lights And Applications
Ad, Landscape Lights And Applications
 
Sport
SportSport
Sport
 
DOCTYPE HTML PUBLIC
DOCTYPE HTML PUBLICDOCTYPE HTML PUBLIC
DOCTYPE HTML PUBLIC
 
La ruta de la sal 2013
La ruta de la sal 2013La ruta de la sal 2013
La ruta de la sal 2013
 
Google themes
Google themesGoogle themes
Google themes
 
Afegir un client SNMP Ubuntu a Cacti
Afegir un client SNMP Ubuntu a CactiAfegir un client SNMP Ubuntu a Cacti
Afegir un client SNMP Ubuntu a Cacti
 
Financial Crisis Coverage: NPR
Financial Crisis Coverage: NPRFinancial Crisis Coverage: NPR
Financial Crisis Coverage: NPR
 
Project in mapeh(bravo)
Project in mapeh(bravo)Project in mapeh(bravo)
Project in mapeh(bravo)
 
Training Program Brief 2011
Training Program Brief 2011Training Program Brief 2011
Training Program Brief 2011
 
Afp toronto 2010 11 f ire up your board for fundraising- easy jobs for every ...
Afp toronto 2010 11 f ire up your board for fundraising- easy jobs for every ...Afp toronto 2010 11 f ire up your board for fundraising- easy jobs for every ...
Afp toronto 2010 11 f ire up your board for fundraising- easy jobs for every ...
 
Ban borring words
Ban borring wordsBan borring words
Ban borring words
 
Featuring my trip to Yunnan
Featuring my trip to YunnanFeaturing my trip to Yunnan
Featuring my trip to Yunnan
 
Sport
SportSport
Sport
 
Incontro mondiale delle famiglie 2012
Incontro mondiale delle famiglie 2012Incontro mondiale delle famiglie 2012
Incontro mondiale delle famiglie 2012
 
Pr1 ri
Pr1 riPr1 ri
Pr1 ri
 
ソーシャルゲームのテクニックで “ゲーミフィケーション”を設計する.
ソーシャルゲームのテクニックで “ゲーミフィケーション”を設計する.ソーシャルゲームのテクニックで “ゲーミフィケーション”を設計する.
ソーシャルゲームのテクニックで “ゲーミフィケーション”を設計する.
 

Similar to Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model

Writing an extensible web testing framework ready for the cloud slide share
Writing an extensible web testing framework ready for the cloud   slide shareWriting an extensible web testing framework ready for the cloud   slide share
Writing an extensible web testing framework ready for the cloud slide share
Mike Ensor
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Doris Chen
 
Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App Engine
Fred Lin
 
Geb with spock
Geb with spockGeb with spock
Geb with spock
Monika Gurram
 
Stanislaw potoczny kra_qa_21.01.20
Stanislaw potoczny kra_qa_21.01.20Stanislaw potoczny kra_qa_21.01.20
Stanislaw potoczny kra_qa_21.01.20
kraqa
 
End-to-end testing with geb
End-to-end testing with gebEnd-to-end testing with geb
End-to-end testing with geb
Jesús L. Domínguez Muriel
 
Geb presentation
Geb presentationGeb presentation
Geb presentation
Ivar Østhus
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
Gurpreet singh
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
Alek Davis
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
Richard Leland
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
Gunnar Hillert
 
Google App Engine with Gaelyk
Google App Engine with GaelykGoogle App Engine with Gaelyk
Google App Engine with Gaelyk
Choong Ping Teo
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
Richard Leland
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
Richard Leland
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
Richard Leland
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
Richard Leland
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
toddbr
 
Learning About JavaScript (…and its little buddy, JQuery!)
Learning About JavaScript (…and its little buddy, JQuery!)Learning About JavaScript (…and its little buddy, JQuery!)
Learning About JavaScript (…and its little buddy, JQuery!)
Julie Meloni
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
Peter Drinnan
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Roy de Kleijn
 

Similar to Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model (20)

Writing an extensible web testing framework ready for the cloud slide share
Writing an extensible web testing framework ready for the cloud   slide shareWriting an extensible web testing framework ready for the cloud   slide share
Writing an extensible web testing framework ready for the cloud slide share
 
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
 
Play Framework on Google App Engine
Play Framework on Google App EnginePlay Framework on Google App Engine
Play Framework on Google App Engine
 
Geb with spock
Geb with spockGeb with spock
Geb with spock
 
Stanislaw potoczny kra_qa_21.01.20
Stanislaw potoczny kra_qa_21.01.20Stanislaw potoczny kra_qa_21.01.20
Stanislaw potoczny kra_qa_21.01.20
 
End-to-end testing with geb
End-to-end testing with gebEnd-to-end testing with geb
End-to-end testing with geb
 
Geb presentation
Geb presentationGeb presentation
Geb presentation
 
Introduction to Jquery
Introduction to JqueryIntroduction to Jquery
Introduction to Jquery
 
Introduction to jQuery
Introduction to jQueryIntroduction to jQuery
Introduction to jQuery
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
 
Google App Engine with Gaelyk
Google App Engine with GaelykGoogle App Engine with Gaelyk
Google App Engine with Gaelyk
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
 
Django at the Disco
Django at the DiscoDjango at the Disco
Django at the Disco
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
Learning About JavaScript (…and its little buddy, JQuery!)
Learning About JavaScript (…and its little buddy, JQuery!)Learning About JavaScript (…and its little buddy, JQuery!)
Learning About JavaScript (…and its little buddy, JQuery!)
 
Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
 

More from vodQA

Performance Testing
Performance TestingPerformance Testing
Performance Testing
vodQA
 
Testing Strategy in Micro Frontend architecture
Testing Strategy in Micro Frontend architectureTesting Strategy in Micro Frontend architecture
Testing Strategy in Micro Frontend architecture
vodQA
 
Api testing libraries using java script an overview
Api testing libraries using java script   an overviewApi testing libraries using java script   an overview
Api testing libraries using java script an overview
vodQA
 
Testing face authentication on mobile
Testing face authentication on mobileTesting face authentication on mobile
Testing face authentication on mobile
vodQA
 
Testing cna
Testing cnaTesting cna
Testing cna
vodQA
 
Etl engine testing with scala
Etl engine testing with scalaEtl engine testing with scala
Etl engine testing with scala
vodQA
 
EDA for QAs
EDA for QAsEDA for QAs
EDA for QAs
vodQA
 
vodQA Pune (2019) - Browser automation using dev tools
vodQA Pune (2019) - Browser automation using dev toolsvodQA Pune (2019) - Browser automation using dev tools
vodQA Pune (2019) - Browser automation using dev tools
vodQA
 
vodQA Pune (2019) - Augmented reality overview and testing challenges
vodQA Pune (2019) - Augmented reality overview and testing challengesvodQA Pune (2019) - Augmented reality overview and testing challenges
vodQA Pune (2019) - Augmented reality overview and testing challenges
vodQA
 
vodQA Pune (2019) - Testing AI,ML applications
vodQA Pune (2019) - Testing AI,ML applicationsvodQA Pune (2019) - Testing AI,ML applications
vodQA Pune (2019) - Testing AI,ML applications
vodQA
 
vodQA Pune (2019) - Design patterns in test automation
vodQA Pune (2019) - Design patterns in test automationvodQA Pune (2019) - Design patterns in test automation
vodQA Pune (2019) - Design patterns in test automation
vodQA
 
vodQA Pune (2019) - Testing ethereum smart contracts
vodQA Pune (2019) - Testing ethereum smart contractsvodQA Pune (2019) - Testing ethereum smart contracts
vodQA Pune (2019) - Testing ethereum smart contracts
vodQA
 
vodQA Pune (2019) - Insights into big data testing
vodQA Pune (2019) - Insights into big data testingvodQA Pune (2019) - Insights into big data testing
vodQA Pune (2019) - Insights into big data testing
vodQA
 
vodQA Pune (2019) - Performance testing cloud deployments
vodQA Pune (2019) - Performance testing cloud deploymentsvodQA Pune (2019) - Performance testing cloud deployments
vodQA Pune (2019) - Performance testing cloud deployments
vodQA
 
vodQA Pune (2019) - Jenkins pipeline As code
vodQA Pune (2019) - Jenkins pipeline As codevodQA Pune (2019) - Jenkins pipeline As code
vodQA Pune (2019) - Jenkins pipeline As code
vodQA
 
vodQA(Pune) 2018 - Consumer driven contract testing using pact
vodQA(Pune) 2018 - Consumer driven contract testing using pactvodQA(Pune) 2018 - Consumer driven contract testing using pact
vodQA(Pune) 2018 - Consumer driven contract testing using pact
vodQA
 
vodQA(Pune) 2018 - Visual testing of web apps in headless environment manis...
vodQA(Pune) 2018 - Visual testing of web apps in headless environment   manis...vodQA(Pune) 2018 - Visual testing of web apps in headless environment   manis...
vodQA(Pune) 2018 - Visual testing of web apps in headless environment manis...
vodQA
 
vodQA(Pune) 2018 - Enhancing the capabilities of testing team preparing for...
vodQA(Pune) 2018 - Enhancing the capabilities of testing team   preparing for...vodQA(Pune) 2018 - Enhancing the capabilities of testing team   preparing for...
vodQA(Pune) 2018 - Enhancing the capabilities of testing team preparing for...
vodQA
 
vodQA(Pune) 2018 - QAing the security way
vodQA(Pune) 2018 - QAing the security wayvodQA(Pune) 2018 - QAing the security way
vodQA(Pune) 2018 - QAing the security way
vodQA
 
vodQA(Pune) 2018 - Docker in Testing
vodQA(Pune) 2018 - Docker in TestingvodQA(Pune) 2018 - Docker in Testing
vodQA(Pune) 2018 - Docker in Testing
vodQA
 

More from vodQA (20)

Performance Testing
Performance TestingPerformance Testing
Performance Testing
 
Testing Strategy in Micro Frontend architecture
Testing Strategy in Micro Frontend architectureTesting Strategy in Micro Frontend architecture
Testing Strategy in Micro Frontend architecture
 
Api testing libraries using java script an overview
Api testing libraries using java script   an overviewApi testing libraries using java script   an overview
Api testing libraries using java script an overview
 
Testing face authentication on mobile
Testing face authentication on mobileTesting face authentication on mobile
Testing face authentication on mobile
 
Testing cna
Testing cnaTesting cna
Testing cna
 
Etl engine testing with scala
Etl engine testing with scalaEtl engine testing with scala
Etl engine testing with scala
 
EDA for QAs
EDA for QAsEDA for QAs
EDA for QAs
 
vodQA Pune (2019) - Browser automation using dev tools
vodQA Pune (2019) - Browser automation using dev toolsvodQA Pune (2019) - Browser automation using dev tools
vodQA Pune (2019) - Browser automation using dev tools
 
vodQA Pune (2019) - Augmented reality overview and testing challenges
vodQA Pune (2019) - Augmented reality overview and testing challengesvodQA Pune (2019) - Augmented reality overview and testing challenges
vodQA Pune (2019) - Augmented reality overview and testing challenges
 
vodQA Pune (2019) - Testing AI,ML applications
vodQA Pune (2019) - Testing AI,ML applicationsvodQA Pune (2019) - Testing AI,ML applications
vodQA Pune (2019) - Testing AI,ML applications
 
vodQA Pune (2019) - Design patterns in test automation
vodQA Pune (2019) - Design patterns in test automationvodQA Pune (2019) - Design patterns in test automation
vodQA Pune (2019) - Design patterns in test automation
 
vodQA Pune (2019) - Testing ethereum smart contracts
vodQA Pune (2019) - Testing ethereum smart contractsvodQA Pune (2019) - Testing ethereum smart contracts
vodQA Pune (2019) - Testing ethereum smart contracts
 
vodQA Pune (2019) - Insights into big data testing
vodQA Pune (2019) - Insights into big data testingvodQA Pune (2019) - Insights into big data testing
vodQA Pune (2019) - Insights into big data testing
 
vodQA Pune (2019) - Performance testing cloud deployments
vodQA Pune (2019) - Performance testing cloud deploymentsvodQA Pune (2019) - Performance testing cloud deployments
vodQA Pune (2019) - Performance testing cloud deployments
 
vodQA Pune (2019) - Jenkins pipeline As code
vodQA Pune (2019) - Jenkins pipeline As codevodQA Pune (2019) - Jenkins pipeline As code
vodQA Pune (2019) - Jenkins pipeline As code
 
vodQA(Pune) 2018 - Consumer driven contract testing using pact
vodQA(Pune) 2018 - Consumer driven contract testing using pactvodQA(Pune) 2018 - Consumer driven contract testing using pact
vodQA(Pune) 2018 - Consumer driven contract testing using pact
 
vodQA(Pune) 2018 - Visual testing of web apps in headless environment manis...
vodQA(Pune) 2018 - Visual testing of web apps in headless environment   manis...vodQA(Pune) 2018 - Visual testing of web apps in headless environment   manis...
vodQA(Pune) 2018 - Visual testing of web apps in headless environment manis...
 
vodQA(Pune) 2018 - Enhancing the capabilities of testing team preparing for...
vodQA(Pune) 2018 - Enhancing the capabilities of testing team   preparing for...vodQA(Pune) 2018 - Enhancing the capabilities of testing team   preparing for...
vodQA(Pune) 2018 - Enhancing the capabilities of testing team preparing for...
 
vodQA(Pune) 2018 - QAing the security way
vodQA(Pune) 2018 - QAing the security wayvodQA(Pune) 2018 - QAing the security way
vodQA(Pune) 2018 - QAing the security way
 
vodQA(Pune) 2018 - Docker in Testing
vodQA(Pune) 2018 - Docker in TestingvodQA(Pune) 2018 - Docker in Testing
vodQA(Pune) 2018 - Docker in Testing
 

Recently uploaded

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
Paul Groth
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 

Recently uploaded (20)

Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 

Comprehensive Browser Automation Solution using Groovy, WebDriver & Obect Model

  • 1. Web Automation using Groovy, WebDriver, JQuery and Page Object Model By: Gaurav Bansal
  • 2. Need… • We need a solution that is based on technology that is native to WebBrowsers. • We need a solution that requires no boilerplate code. • We need a solution that offers a powerful set of tools for matching a set of elements in a document. • We need a solution that offers in-built mechanism to incorporate Page-object model
  • 4. What is Geb? • Geb is a browser automation solution. • You can use it for… – Acceptance Testing Web Applications – Automating Web Sites – Screen Scraping • It brings together the… – Cross browser automation capabilities of WebDriver – Elegance of jQuery content selection – Expressiveness of the Groovy language – Robustness of Page Object modelling
  • 5. About the Project • Free Open Source, Apache License, Version 2.0. • Currently at version 0.7.0. – Home Page — http://www.gebish.org – The Book of Geb — http://www.gebish.org /manual/current – Source Code — https://github.com/geb/geb – User Mailing List — http:// xircles.codehaus.org/projects/geb/lists – In Maven Central — http:// mvnrepository.com/artifact/org.codehaus.geb
  • 6. Project Components • The heart is the geb-core component which is all you really need (plus WebDriver). • For testing, you probably also want one of these as well: – geb-spock – geb-junit3 – geb-junit4 – geb-testng – geb-easyb • (Has been used from Cucumber as well). • There is also a Grails plugin.
  • 7. WebDriver http:// seleniumhq.org/projects/webdriver/
  • 8. WebDriver • Successor to the Selenium project. • Also known as “Selenium 2”. • Sponsored and driven by Google. • Becoming a W3C standard. – http://dvcs.w3.org/hg/webdriver/raw- file/515b648d58ff/webdriver-spec.html
  • 9. Cross-browser Automation Java based, with many language bindings. import org.openqa.selenium.WebDriver;  import org.openqa.selenium.WebElement;  import org.openqa.selenium.By;  import org.openqa.selenium.firefox.FirefoxDriver;  WebDriver driver = new FirefoxDriver();  driver.get("http://google.com");  WebElement heading = driver.findElement(By.tagName("h1")); 
  • 10. Mobile Browsers • Rapidly improving. – iPad – iPhone – Android – Blackberry • Can use real devices or emulators in most cases. • A headless webkit based driver (PhantomJS) is in progress.
  • 11. WebDriver API • Geb sits on top of WebDriver so you very rarely deal with its API, though it's accessible if you need it. • Geb never talks to the actual browser because that's what WebDriver does.
  • 12. Driver dependency • You need to pull in a specific driver implementation for each browser you want to work with. – <dependency> – <groupId>org.seleniumhq.selenium</groupId> – <artifactId>selenium-firefox-driver</artifactId> – <version>2.24.1</version> – </dependency>
  • 14. JQuery • jQuery provides an incredibly powerful API for navigating and selecting content. – $("div#footer").prev().children(); – CSS based, a whole lot better than XPath.
  • 15. Geb's inspiration • Geb features a “Navigator API” that is inspired by jQuery. – // This is Geb code, not jQuery JavaScript… $ ("h1").previous().children(); • API is not identical.
  • 17. Dynamic JVM Lang. • Groovy is… – Compiled, never interpreted – Dynamic, optionally typed – 99% Java syntax compatible – Concise, clear and pragmatic – Great for DSLs – A comfortable Java alternative for most
  • 18. Geb & Groovy • Geb uses Groovy's dynamism to remove boilerplate. import geb.* Browser.drive { to GoogleHomePage at GoogleHomePage search.forTerm "wikipedia“ at GoogleResultsPage  assert firstResultLink.text() == "Wikipedia"  firstResultLink.click() waitFor { at WikipediaPage } } 
  • 19. Page Objects The key to not pulling your hair out when dealing with web tests.
  • 20. What are they? • In a phrase: Domain Modelling. • By modelling and creating abstractions, we can isolate implementation detail. $("input[name=username]").value("user") $("input[name=pwd]").value("password") $("input[type=submit]").click()  • Is far more fragile than this… void login(String username, String password) {  $("input[name=username]").value(username) $("input[name=pwd]").value(password) $("input[type=submit]").click() } login("user", "password") 
  • 21. Just good programming • It's the application of trusted principles; encapsulation and reuse. • Not new at all, but new to the world of web testing/automation. • Not just about modelling “pages”. It's about modelling all kinds of things in the domain of a user's actions online. • Just giving symbolic names to page content is a great start.
  • 22. Browser has-a Page Browser.drive {  to GoogleHomePage  at GoogleHomePage  search.forTerm "wikipedia"  at GoogleResultsPage  assert firstResultLink.text() == "Wikipedia"  firstResultLink.click() waitFor { at WikipediaPage } }  • The to() and click() methods are changing the underlying page. • You can refer to the current page's content and methods just by name.
  • 23. Geb's Page Objects • Geb builds the Page Object pattern directly into the framework (though it is optional). import geb.* class GoogleHomePage extends Page {  static url = "http://google.com/ncr"   static at = { title == "Google" }  static content = {  search { module GoogleSearchModule } }  } 
  • 24. Geb's Page Objects • Features the “Content DSL” for naming content in a dynamic and powerful way. import geb.* class GoogleResultsPage extends Page {  static at = { waitFor { title.endsWith("Google Search") } }    static content = {          search { module GoogleSearchModule }           results { $("li.g") }          result { i -> results[i] }             resultLink { i -> result(i).find("a.l", 0) }          firstResultLink { resultLink(0) }     } } 
  • 25. Modules • Modules are repeating and/or reappearing content.  import geb.*  class GoogleSearchModule extends Module {      static content = {          field { $("input", name: "q") }          button(to: GoogleResultsPage) { btnG() }      }     class StandardPage extends Page {      static content = {   gmod { module  GoogleSearchModule  }     }  } 
  • 27. Geb for Testing • Geb can be used with… – Spock – JUnit (3 & 4) – TestNG – EasyB – Cucumber (Cuke4Duke) • The majority of Geb users use Spock. • Geb can dump HTML and screenshots for each “test” to help in debugging.
  • 28. Navigator API jQuery inspired content selection/ navigation
  • 29. The $() method • Returns a Navigator object. • General format: –$ («css selector», «index/range», «attribute/text matchers») • Examples: – $("div") // all divs  – $("div", 0) // first div $("div", 0..2) // first three divs  – // The third section heading with text “Geb” $("h2", 2, id: "section", text: "Geb") 
  • 30. CSS Selectors • Full CSS3 if the target browser supports it. $("div.some-class p:first[title='something']") $("ul li a") $("table tr:nth-child(2n+1) td") $("div#content p:first-child::first-line")  • CSS lookups are fast.
  • 31. Attribute/Text match • Can match on attribute values: – //<div foo="bar"> – $("div", foo: "bar") • The “text” attribute is special: – //<div>foo</div>  – $("div", text: "foo") • Can use Regular Expressions: – //<div>foo</div>  – $("div", text: ~/f.+/) 
  • 32. Predicates • Geb supplies some handy predicates: $("p", text: startsWith("p"))  $("p", class: contains("section"))  $("p", id: endsWith(~/d/))
  • 33. Relative Content • $() returns a Navigator that allows you to find relative content. $("p").previous() $("p").prevAll() $("p").next() $("p").nextAll() $("p").parent() $("p").siblings() $("div").children()  • Most of these methods take selectors, indexes and attribute text/matchers too. $("p").nextAll(".listing") 
  • 35. Content DSL class GoogleResultsPage extends Page {      static content = {         results { $("li.g") }         result { i -> results[i] }            resultLink { i -> result(i).find("a.l", 0) }          firstResultLink { resultLink(0) }      } }  • Content definitions can build upon each other. • Content definitions are actually templates.
  • 36. Optional Content class OptionalPage extends Page {     static content = {      errorMsg(required: false) { $("p.errorMsg") }    }  } • By default, Geb will error if the content you select doesn't exist. • The “required” option disables this check.
  • 37. Dynamic Content class DynamicPage extends Page {      static content = {          errorMsg(wait: true) { $("p.errorMsg") }      } } • Geb will wait for some time for this content to appear. • By default, it will look for it every 100ms for 5s before giving up. This is highly configurable. • Same semantics as the waitFor {} method that can be used anywhere.
  • 38. Expensive Content class ExpensivePage extends Page {      static content = {          results(cache: true) { $("li.results") }         result { results[it] }      }  }  • By default, all content is transient. • The cache option instructs Geb to hold on to the content, avoiding redundant lookups. • Use carefully, can cause problems with dynamic pages.
  • 40. The to() method class GoogleHomePage extends Page {      static url = "http://google.com/ncr"  } • Pages can define a url that defines the page location. • The to() method sends the browser there and sets that as the current page object. • to GoogleHomePage The page url can be relative (will be resolved against a config driven base).
  • 41. Content based navigation class FrontPage {      static content = {      aboutUsLink(to: AboutUsPage) { $("div#nav ul li a", text: iStartsWith("About Us")) }     } } • When this content is clicked, the underlying page will be changed implicitly. to FrontPage aboutUsLink.click()  page instanceof AboutUsPage 
  • 42. At Checking • The “at checking” mechanism enables fail fast and less debugging. class LoginPage extends Page {      static at = { $("h1").text() == "Please log in" }  } browser.at LoginPage  • Will throw an exception if every statement of the at check is not true.
  • 43. Driver Management • Geb caches the WebDriver instance (per thread) and shares it across test cases. • Manages clearing cookies and is configurable. • This can be disabled and tuned.
  • 44. Config. Management • Looks for GebConfig class or GebConfig.groovy file (or class) on classpath. driver = {  new FirefoxDriver()  } waiting { timeout = 2  slow { timeout = 100 } }  reportsDir = "geb-reports“ environments { chrome { driver = "chrome" } } 
  • 45. What we didn't see • JavaScript interface • jQuery interface • Direct Downloading • Multi Window support • Frame support • Page Change Listening • Actions (e.g. Drag & Drop) • alert()/confirm() handling
  • 46. Summary JUnit3 Spock Grails JUnit4 EasyB
  • 47. Thanks » @gaurav_bansal » gbansal@xebia.com / itsbansal@gmail.com » +91-9899849992