Submit Search
Upload
Better Selenium Tests with Geb - Selenium Conf 2014
Report
Share
Naresha K
Developer | Technical Excellence Coach | Consultant | Trainer at Independent
Follow
•
4 likes
•
4,887 views
1
of
42
Better Selenium Tests with Geb - Selenium Conf 2014
•
4 likes
•
4,887 views
Report
Share
Download Now
Download to read offline
Software
Slide of my Selenium Conference 2014 2014 - Sept 6, 2014.
Read more
Naresha K
Developer | Technical Excellence Coach | Consultant | Trainer at Independent
Follow
Recommended
Pragmatic Browser Automation with Geb - GIDS 2015 by
Pragmatic Browser Automation with Geb - GIDS 2015
Naresha K
1.8K views
•
49 slides
jQuery in 15 minutes by
jQuery in 15 minutes
Simon Willison
41.5K views
•
14 slides
Introduction to jQuery by
Introduction to jQuery
manugoel2003
2.2K views
•
36 slides
Introduction to jQuery by
Introduction to jQuery
Gunjan Kumar
2.8K views
•
45 slides
JQuery introduction by
JQuery introduction
NexThoughts Technologies
1.6K views
•
26 slides
Drupal Best Practices by
Drupal Best Practices
manugoel2003
5.4K views
•
47 slides
More Related Content
What's hot
Learning jQuery in 30 minutes by
Learning jQuery in 30 minutes
Simon Willison
53.4K views
•
31 slides
jQuery by
jQuery
Mostafa Bayomi
9.5K views
•
77 slides
Prototype & jQuery by
Prototype & jQuery
Remy Sharp
37K views
•
25 slides
jQuery Essentials by
jQuery Essentials
Bedis ElAchèche
2.8K views
•
83 slides
Javascript first-class citizenery by
Javascript first-class citizenery
toddbr
1.2K views
•
32 slides
jQuery Essentials by
jQuery Essentials
Marc Grabanski
173.8K views
•
115 slides
What's hot
(20)
Learning jQuery in 30 minutes by Simon Willison
Learning jQuery in 30 minutes
Simon Willison
•
53.4K views
jQuery by Mostafa Bayomi
jQuery
Mostafa Bayomi
•
9.5K views
Prototype & jQuery by Remy Sharp
Prototype & jQuery
Remy Sharp
•
37K views
jQuery Essentials by Bedis ElAchèche
jQuery Essentials
Bedis ElAchèche
•
2.8K views
Javascript first-class citizenery by toddbr
Javascript first-class citizenery
toddbr
•
1.2K views
jQuery Essentials by Marc Grabanski
jQuery Essentials
Marc Grabanski
•
173.8K views
Jquery by Girish Srivastava
Jquery
Girish Srivastava
•
5.2K views
jQuery by Dileep Mishra
jQuery
Dileep Mishra
•
3.8K views
Sprout core and performance by Yehuda Katz
Sprout core and performance
Yehuda Katz
•
1.4K views
jQuery PPT by Dominic Arrojado
jQuery PPT
Dominic Arrojado
•
20.4K views
jQuery Fundamentals by Gil Fink
jQuery Fundamentals
Gil Fink
•
5.4K views
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K by Thomas Fuchs
Zepto.js, a jQuery-compatible mobile JavaScript framework in 2K
Thomas Fuchs
•
13.6K views
jQuery Presentation by Rod Johnson
jQuery Presentation
Rod Johnson
•
4.7K views
A Short Introduction To jQuery by Sudar Muthu
A Short Introduction To jQuery
Sudar Muthu
•
2.5K views
End-to-end testing with geb by Jesús L. Domínguez Muriel
End-to-end testing with geb
Jesús L. Domínguez Muriel
•
2K views
Html5 For Jjugccc2009fall by Shumpei Shiraishi
Html5 For Jjugccc2009fall
Shumpei Shiraishi
•
1.9K views
jQuery by Mohammed Arif
jQuery
Mohammed Arif
•
2.2K views
jQuery for beginners by Siva Arunachalam
jQuery for beginners
Siva Arunachalam
•
8K views
JavaScript and jQuery Basics by Kaloyan Kosev
JavaScript and jQuery Basics
Kaloyan Kosev
•
3.5K views
前端概述 by Ethan Zhang
前端概述
Ethan Zhang
•
563 views
Viewers also liked
Cloud browser testing with Gradle and Geb by
Cloud browser testing with Gradle and Geb
David Carr
2.1K views
•
7 slides
Design Patterns from 10K feet by
Design Patterns from 10K feet
Naresha K
424 views
•
17 slides
Java beyond Java - from the language to platform by
Java beyond Java - from the language to platform
Naresha K
284 views
•
35 slides
Geb presentation by
Geb presentation
Ivar Østhus
1.6K views
•
19 slides
What makes Geb groovy? by
What makes Geb groovy?
Youtarou TAKAHASHI
8.7K views
•
157 slides
Geb with spock by
Geb with spock
Monika Gurram
38.9K views
•
14 slides
Viewers also liked
(6)
Cloud browser testing with Gradle and Geb by David Carr
Cloud browser testing with Gradle and Geb
David Carr
•
2.1K views
Design Patterns from 10K feet by Naresha K
Design Patterns from 10K feet
Naresha K
•
424 views
Java beyond Java - from the language to platform by Naresha K
Java beyond Java - from the language to platform
Naresha K
•
284 views
Geb presentation by Ivar Østhus
Geb presentation
Ivar Østhus
•
1.6K views
What makes Geb groovy? by Youtarou TAKAHASHI
What makes Geb groovy?
Youtarou TAKAHASHI
•
8.7K views
Geb with spock by Monika Gurram
Geb with spock
Monika Gurram
•
38.9K views
Similar to Better Selenium Tests with Geb - Selenium Conf 2014
jQuery basics by
jQuery basics
Stijn Van Minnebruggen
651 views
•
61 slides
What you need to know bout html5 by
What you need to know bout html5
Kevin DeRudder
973 views
•
113 slides
Creating GUI container components in Angular and Web Components by
Creating GUI container components in Angular and Web Components
Rachael L Moore
493 views
•
144 slides
J query b_dotnet_ug_meet_12_may_2012 by
J query b_dotnet_ug_meet_12_may_2012
ghnash
1.1K views
•
40 slides
HTML5 New and Improved by
HTML5 New and Improved
Timothy Fisher
6.8K views
•
46 slides
HTML5 Essentials by
HTML5 Essentials
Marc Grabanski
43.6K views
•
62 slides
Similar to Better Selenium Tests with Geb - Selenium Conf 2014
(20)
jQuery basics by Stijn Van Minnebruggen
jQuery basics
Stijn Van Minnebruggen
•
651 views
What you need to know bout html5 by Kevin DeRudder
What you need to know bout html5
Kevin DeRudder
•
973 views
Creating GUI container components in Angular and Web Components by Rachael L Moore
Creating GUI container components in Angular and Web Components
Rachael L Moore
•
493 views
J query b_dotnet_ug_meet_12_may_2012 by ghnash
J query b_dotnet_ug_meet_12_may_2012
ghnash
•
1.1K views
HTML5 New and Improved by Timothy Fisher
HTML5 New and Improved
Timothy Fisher
•
6.8K views
HTML5 Essentials by Marc Grabanski
HTML5 Essentials
Marc Grabanski
•
43.6K views
Html5 intro by Kevin DeRudder
Html5 intro
Kevin DeRudder
•
1.4K views
Play!ng with scala by Siarzh Miadzvedzeu
Play!ng with scala
Siarzh Miadzvedzeu
•
7K views
Building iPhone Web Apps using "classic" Domino by Rob Bontekoe
Building iPhone Web Apps using "classic" Domino
Rob Bontekoe
•
1.6K views
Html5 by Satoshi Kikuchi
Html5
Satoshi Kikuchi
•
1.6K views
HTML5 by Brandon Byars
HTML5
Brandon Byars
•
465 views
jQuery Basic API by Hyeonseok Shin
jQuery Basic API
Hyeonseok Shin
•
1.3K views
Resource Registries: Plone Conference 2014 by Rob Gietema
Resource Registries: Plone Conference 2014
Rob Gietema
•
571 views
J query training by FIS - Fidelity Information Services
J query training
FIS - Fidelity Information Services
•
429 views
Practical HTML5: Using It Today by Doris Chen
Practical HTML5: Using It Today
Doris Chen
•
972 views
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group) by Doris Chen
jQuery Makes Writing JavaScript Fun Again (for HTML5 User Group)
Doris Chen
•
9.5K views
HTML5, the new buzzword by Frédéric Harper
HTML5, the new buzzword
Frédéric Harper
•
433 views
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012 by crokitta
Oracle Application Express & jQuery Mobile - OGh Apex Dag 2012
crokitta
•
1.7K views
jQuery, CSS3 and ColdFusion by Denard Springle IV
jQuery, CSS3 and ColdFusion
Denard Springle IV
•
2.7K views
Enjoy the vue.js by TechExeter
Enjoy the vue.js
TechExeter
•
1.4K views
More from Naresha K
The Groovy Way of Testing with Spock by
The Groovy Way of Testing with Spock
Naresha K
240 views
•
40 slides
Evolving with Java - How to Remain Effective by
Evolving with Java - How to Remain Effective
Naresha K
243 views
•
74 slides
Take Control of your Integration Testing with TestContainers by
Take Control of your Integration Testing with TestContainers
Naresha K
268 views
•
50 slides
Implementing Resilience with Micronaut by
Implementing Resilience with Micronaut
Naresha K
344 views
•
20 slides
Take Control of your Integration Testing with TestContainers by
Take Control of your Integration Testing with TestContainers
Naresha K
281 views
•
21 slides
Favouring Composition - The Groovy Way by
Favouring Composition - The Groovy Way
Naresha K
229 views
•
48 slides
More from Naresha K
(20)
The Groovy Way of Testing with Spock by Naresha K
The Groovy Way of Testing with Spock
Naresha K
•
240 views
Evolving with Java - How to Remain Effective by Naresha K
Evolving with Java - How to Remain Effective
Naresha K
•
243 views
Take Control of your Integration Testing with TestContainers by Naresha K
Take Control of your Integration Testing with TestContainers
Naresha K
•
268 views
Implementing Resilience with Micronaut by Naresha K
Implementing Resilience with Micronaut
Naresha K
•
344 views
Take Control of your Integration Testing with TestContainers by Naresha K
Take Control of your Integration Testing with TestContainers
Naresha K
•
281 views
Favouring Composition - The Groovy Way by Naresha K
Favouring Composition - The Groovy Way
Naresha K
•
229 views
Effective Java with Groovy - How Language Influences Adoption of Good Practices by Naresha K
Effective Java with Groovy - How Language Influences Adoption of Good Practices
Naresha K
•
294 views
What's in Groovy for Functional Programming by Naresha K
What's in Groovy for Functional Programming
Naresha K
•
275 views
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo... by Naresha K
Effective Java with Groovy & Kotlin - How Languages Influence Adoption of Goo...
Naresha K
•
208 views
Effective Java with Groovy & Kotlin How Languages Influence Adoption of Good ... by Naresha K
Effective Java with Groovy & Kotlin How Languages Influence Adoption of Good ...
Naresha K
•
162 views
Eclipse Collections, Java Streams & Vavr - What's in them for Functional Pro... by Naresha K
Eclipse Collections, Java Streams & Vavr - What's in them for Functional Pro...
Naresha K
•
499 views
Implementing Cloud-Native Architectural Patterns with Micronaut by Naresha K
Implementing Cloud-Native Architectural Patterns with Micronaut
Naresha K
•
402 views
Groovy - Why and Where? by Naresha K
Groovy - Why and Where?
Naresha K
•
79 views
Leveraging Micronaut on AWS Lambda by Naresha K
Leveraging Micronaut on AWS Lambda
Naresha K
•
310 views
Groovy Refactoring Patterns by Naresha K
Groovy Refactoring Patterns
Naresha K
•
514 views
Implementing Cloud-native Architectural Patterns with Micronaut by Naresha K
Implementing Cloud-native Architectural Patterns with Micronaut
Naresha K
•
667 views
Effective Java with Groovy by Naresha K
Effective Java with Groovy
Naresha K
•
501 views
Evolving with Java - How to remain Relevant and Effective by Naresha K
Evolving with Java - How to remain Relevant and Effective
Naresha K
•
294 views
Effective Java with Groovy - How Language can Influence Good Practices by Naresha K
Effective Java with Groovy - How Language can Influence Good Practices
Naresha K
•
311 views
Beyond Lambdas & Streams - Functional Fluency in Java by Naresha K
Beyond Lambdas & Streams - Functional Fluency in Java
Naresha K
•
186 views
Recently uploaded
Introduction to Gradle by
Introduction to Gradle
John Valentino
7 views
•
7 slides
Transport Management System - Shipment & Container Tracking by
Transport Management System - Shipment & Container Tracking
Freightoscope
6 views
•
3 slides
Automated Testing of Microsoft Power BI Reports by
Automated Testing of Microsoft Power BI Reports
RTTS
11 views
•
20 slides
Playwright Retries by
Playwright Retries
artembondar5
7 views
•
1 slide
Google Solutions Challenge 2024 Talk pdf by
Google Solutions Challenge 2024 Talk pdf
MohdAbdulAleem4
34 views
•
17 slides
Supercharging your Python Development Environment with VS Code and Dev Contai... by
Supercharging your Python Development Environment with VS Code and Dev Contai...
Dawn Wages
5 views
•
51 slides
Recently uploaded
(20)
Introduction to Gradle by John Valentino
Introduction to Gradle
John Valentino
•
7 views
Transport Management System - Shipment & Container Tracking by Freightoscope
Transport Management System - Shipment & Container Tracking
Freightoscope
•
6 views
Automated Testing of Microsoft Power BI Reports by RTTS
Automated Testing of Microsoft Power BI Reports
RTTS
•
11 views
Playwright Retries by artembondar5
Playwright Retries
artembondar5
•
7 views
Google Solutions Challenge 2024 Talk pdf by MohdAbdulAleem4
Google Solutions Challenge 2024 Talk pdf
MohdAbdulAleem4
•
34 views
Supercharging your Python Development Environment with VS Code and Dev Contai... by Dawn Wages
Supercharging your Python Development Environment with VS Code and Dev Contai...
Dawn Wages
•
5 views
tecnologia18.docx by nosi6702
tecnologia18.docx
nosi6702
•
6 views
Benefits in Software Development by John Valentino
Benefits in Software Development
John Valentino
•
6 views
Page Object Model by artembondar5
Page Object Model
artembondar5
•
7 views
Introduction to Maven by John Valentino
Introduction to Maven
John Valentino
•
7 views
Techstack Ltd at Slush 2023, Ukrainian delegation by ViktoriiaOpanasenko
Techstack Ltd at Slush 2023, Ukrainian delegation
ViktoriiaOpanasenko
•
7 views
predicting-m3-devopsconMunich-2023-v2.pptx by Tier1 app
predicting-m3-devopsconMunich-2023-v2.pptx
Tier1 app
•
14 views
POS Software in Bangladesh.pdf by SEOServiceProviderBa
POS Software in Bangladesh.pdf
SEOServiceProviderBa
•
6 views
University of Borås-full talk-2023-12-09.pptx by Mahdi_Fahmideh
University of Borås-full talk-2023-12-09.pptx
Mahdi_Fahmideh
•
12 views
What is API by artembondar5
What is API
artembondar5
•
15 views
Top-5-production-devconMunich-2023-v2.pptx by Tier1 app
Top-5-production-devconMunich-2023-v2.pptx
Tier1 app
•
9 views
Introduction to Git Source Control by John Valentino
Introduction to Git Source Control
John Valentino
•
8 views
predicting-m3-devopsconMunich-2023.pptx by Tier1 app
predicting-m3-devopsconMunich-2023.pptx
Tier1 app
•
10 views
aATP - New Correlation Confirmation Feature.pptx by EsatEsenek1
aATP - New Correlation Confirmation Feature.pptx
EsatEsenek1
•
222 views
Using Qt under LGPL-3.0 by Burkhard Stubert
Using Qt under LGPL-3.0
Burkhard Stubert
•
14 views
Better Selenium Tests with Geb - Selenium Conf 2014
1.
Better Selenium Tests
with Geb Naresha K Enteleki Solutions naresha.k@gmail.com @naresha_k
2.
http://martinfowler.com/bliki/PageObject.html WebDriver ChromeDriver
FirefoxDriver InternetExplorerDriver
3.
WebDriver WebDriverJS Selenium
server ChromeDriver FirefoxDriver InternetExplorerDriver
4.
Level of Abstraction
https://www.flickr.com/photos/pagedooley/3028798210
5.
WebDriver WebDriverJS Selenium
server ChromeDriver FirefoxDriver InternetExplorerDriver
6.
Any problem in
computer science can be solved with another layer of indirection David Wheeler https://www.flickr.com/photos/pc_plod/14187378533
8.
Web Driver
9.
Geb
10.
Browser import geb.Browser!
import org.openqa.selenium.firefox.FirefoxDriver! ! Browser browser = new Browser(driver: new FirefoxDriver())!
11.
Browser import geb.Browser!
import org.openqa.selenium.firefox.FirefoxDriver! ! Browser browser = new Browser(driver: new FirefoxDriver())! // driver.get("http://seleniumconf.org/")! browser.go 'http://seleniumconf.org/'!
12.
External Config //
GebConfig.groovy! import org.openqa.selenium.firefox.FirefoxDriver! ! driver = { ! ! def driverInstance = new FirefoxDriver() ! ! driverInstance.manage().window().maximize() ! ! driverInstance ! } ! Browser browser = new Browser()! ! // driver.get("http://seleniumconf.org/")! browser.go 'http://seleniumconf.org/'! browser.quit()!
13.
Accessing Elements //
driver.findElement(By.name("j_username")) ! def username = browser.$(name: 'j_username')! // username.sendKeys("user1")! username << 'user1'! println username.value()!
14.
Geb Browser
15.
Hello Geb Browser
browser = new Browser()! browser.go “http://localhost:8000/app/login.html"! browser.$(name: 'j_username') << 'user1'! browser.$(name: 'j_password') << 'secret'! browser.$('#submit').click()! browser.quit()!
16.
Hello Geb -
Improved Browser.drive{! ! go “http://localhost:8000/app/login.html"! ! $(name: 'j_username') << 'user1'! ! $(name: 'j_password') << 'secret'! ! $('#submit').click()! }.quit()!
17.
Configurable URL //
GebConfig.groovy! baseUrl = "http://localhost:8000/app/" ! Browser.drive{! ! go “login.html”! ! $(name: 'j_username') << 'user1'! ! $(name: 'j_password') << 'secret'! ! $('#submit').click()! }.quit()!
18.
Assertion assert $('h1').text()
== 'Dashboard'!
19.
Navigator API
20.
Navigator Syntax $(<css
selector>, <index or range>, <attribute / text matchers>)
21.
<h2>Introduction</h2>! <h2>Navigator</h2>! <h2>Page
Objects</h2>! <h2>Summary</h2>! $('h2').text() == 'Introduction'! $('h2', 1).text() == 'Navigator'! $('h2').size() == 4!
22.
<h2>Introduction</h2>! <h2>Navigator</h2>! <h2>Page
Objects</h2>! <h2>Summary</h2>! $('h2', 0..2)*.text() == ! ! ! ['Introduction', 'Navigator', 'Page Objects']!
23.
<h2 duration="5">Introduction</h2>! <h2
duration="15">Navigator</h2>! <h2>Page Objects</h2>! <h2 duration="5">Summary</h2>! $('h2', duration: '5').size() == 2! $('h2', text: 'Summary').size() == 1!
24.
<h2 duration="5">Introduction</h2>! <h2
duration="15">Navigator</h2>! <h2>Page Objects</h2>! <h2 duration="5">Summary</h2>! $('h2', text: contains('o')).size() == 2! $('h2', text: iContains('o')).size() == 3! $('h2', duration: contains('5')).size() == 3!
25.
<div class="languages">! !
! <div class="language jvm">Java</div>! ! ! <div class="language clr">C#</div>! ! ! <div class="language jvm">Groovy</div>! ! ! <div class="language clr">F#</div>! ! ! <div class="language erlang">Elixir</div>! </div> $('div.languages').find('.jvm').each{ element ->! ! ! println element.text()! } Java Groovy
26.
<div class="languages">! !
! <div class="language jvm">Java</div>! ! ! <div class="language clr">C#</div>! ! ! <div class="language jvm">Groovy</div>! ! ! <div class="language clr">F#</div>! ! ! <div class="language erlang">Elixir</div>! </div> $('.language').filter('.jvm').each{ element ->! ! ! println element.text()! } Java Groovy $('.language').not('.clr').each{ element ->! ! ! println element.text()! } Java Groovy Elixir
27.
Page Objects
28.
Page Objects
29.
Modules
30.
Modules
32.
Modules class Record
extends Module{! ! static content = {! ! ! column {index -> $('td', index)}! ! ! productCode {column(1).text()}! ! ! price { column(2).text().toInteger()}! ! }! } class ProductPage extends Page{! ! static url = 'table.html'! ! static content = {! ! ! products {moduleList Record, $('table tbody tr')}! ! }! }
33.
Modules Browser.drive() {!
! to ProductPage! ! products.each{ product ->! ! ! println "${product.productCode} -> ${product.price}"! ! }! }.quit()
34.
Modules List
35.
Waiting
36.
Wait <div id="dynamic"></div>
waitFor { $('#dynamic').text()}! waitFor(8) { $('#dynamic').text()}! waitFor(8, 0.5) { $('#dynamic').text()}! waitFor('slow') { $('#dynamic').text()} // GebConfig.groovy! waiting {! presets {! slow {! timeout = 12! retryInterval = 1! }! }! }
37.
Integration https://www.flickr.com/photos/lumaxart/2137737248
38.
Supported Frameworks
39.
@Stepwise! class SampleGebSpec
extends GebReportingSpec{! ! def "User can login"(){! !! when:! !! ! to LoginPage! ! ! ! login('user1', 'secret')! ! ! then:! ! ! ! at DashboardPage! ! ! ! and:! ! ! ! header.pageTitle == 'Dashboard'! }! ! }! Spock Example
40.
Integration
41.
Summary • Power
of WebDriver • Elegance of jQuery selection • Robustness of Page Object modeling • Expressiveness of Groovy Welcome Geb
42.
References Official Geb
Page - http://www.gebish.org/ ! Example - https://github.com/geb/geb-example-gradle ! Spock Documentation - http://spock-framework. readthedocs.org/en/latest/ ! Code samples - https://github.com/naresha/seconf2014