SlideShare une entreprise Scribd logo
1  sur  25
Getting started with
               Selenium 2
                      Sebastiano Armeli-Battana
                              @sebarmeli
                     https://github.com/sebarmeli



November 17 , 2011                         Open Source Developers Conference, Canberra
What is Selenium?

Open Source Web Application Testing System


Automated UI Testing


Functional type of tests


Multiple browsers, multiple languages
History


 2004        2007      2009    2011


Selenium   WebDriver
                        Selenium 2
Selenium
Selenium
Selenium Core : JavaScript Framework
Selenium
Selenium Core : JavaScript Framework
-          IDE
    Firefox Plugin
Selenium
Selenium Core : JavaScript Framework
  -            IDE
       Firefox Plugin



   -           Remote Control (RC)
	

    Server : Proxy to launch browsers
       Client libraries
Selenium
Selenium Core : JavaScript Framework
  -             IDE
        Firefox Plugin



   -            Remote Control (RC)
	

     Server : Proxy to launch browsers
        Client libraries



   -            Grid
       Distributed remote tests
WebDriver

“Best fit” language
	


Clean & Object Oriented API


HtmlUnitDriver


Java bindings
Selenium 2
  -            IDE
 -              Web Driver
	

          Bindings : Java, C#, Python, Ruby

          WebDriver API

          Simplified Architecture              Selenium Server NOT needed *



      -        Grid 2
Selenium Server


Replicate Selenium RC functionalities




Selenium Grid 2
First steps
Java / C# bindings
Selenium Server
Android APK
http://code.google.com/p/selenium/downloads/list


Chrome Driver
http://code.google.com/p/chromium/downloads/list

Ruby
gem install selenium-webdriver

Python
pip install selenium / easy_install selenium
Let’s code!
Locator Strategies
• Id
 webDriver.findElement(By.id("logo"));

• Name
 webDriver.findElement(By.name("q"));

• Tag Name
 webDriver.findElement(By.tagName("H1"));

• Class name
 webDriver.findElements(By.className("sponsor_logos"));

• CSS Selector
 webDriver.findElement(By.cssSelector("section#sponsor>p"));

• XPath
 webDriver.findElement(By.xpath("//section[@id=‘miniconfs’]/a[2]"));

• Link Text
 webDriver.findElements(By.linkText("About"));

• Partial Link Text
 webDriver.findElement(By.partialLinkText("visitcanberra"));
Page interactions

webElement.click()


webElement.sendKeys(...)


webElement.submit()


Actions class              Mouse Events / Drag and Drop
AJAX applications
DOM Elements loaded asynchronously


a) Polling the DOM for n seconds
webDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);   (Java)

webDriver.manage.timeouts.implicit_wait = 30 (Ruby)

webDriver.implicit_wait(30)   (Python)




b) Wait until condition occurs
ExpectedCondition / WebDriverWait
Testing style and executing JS
Testing CSS properties
webElement.getCssValue(“height”);

webElement.getCssValue(“background-image”);




Javascript execution
JavascriptExecutor js = (JavascriptExecutor) webDriver;

Long value = (Long) js.executeScript("return window.scrollY");
TargetLocator and Navigation Interfaces

TargetLocator             Frames and Popup Dialogs
TargetLocator target = webDriver.switchTo();

WebElement element = target.frame(“name”)

Alert alert = target.alert();




Navigation               Browser buttons emulation
Navigation nav = webDriver.navigate();

nav.back(); / nav.forward(); nav.to(“url”);
Migrating from Selenium 1
Selenium selenium = new WebDriverBackedSelenium(webDriver,
                         “http://osdc.com.au”);




selenium.open("http://osdc.com.au");
selenium.click("id=follow_twitter");
selenium.waitForPageToLoad("10000");




WebDriver webDriver = ((WebDriverBackedSelenium)
                           selenium).getUnderlyingWebDriver();
Page Object Pattern / PageFactory
Pages as Objects



Separation between DOM and services in a Page



WebDriver API not exposed



PageFactory class to easily instantiate a Page Object
Selenium Grid 2
Starting Hub
 java -jar selenium-server-standalone-2.9.0.jar -role hub


Starting WebDriver Node
 java -jar selenium-server-standalone-2.9.0.jar -role webdriver -
hub http://localhost:4444/grid/register -browser
browserName=chrome,version=15,platform=MAC -port 5556



Grid console
http://localhost:4444/grid/console



Launching Test Remotely (Java)
Mobile Testing
Selenium 2 - Java QuickStart
               Archetype
https://github.com/sebarmeli/Selenium2-Java-QuickStart-Archetype
Resources
http://www.slideshare.net/sebarmeli/getting-started-with-selenium-2


https://github.com/sebarmeli/Selenium2-Java-Demo


http://seleniumhq.org/


http://code.google.com/p/selenium/



Google Groups
Questions ?

Contenu connexe

Tendances

Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJSKrishna Kumar
 
Automated testing with Drupal
Automated testing with DrupalAutomated testing with Drupal
Automated testing with DrupalPromet Source
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsSeth McLaughlin
 
Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Adam Christian
 
How to Configure Selenium WebDriver (java)
How to Configure Selenium WebDriver (java)How to Configure Selenium WebDriver (java)
How to Configure Selenium WebDriver (java)Dasun Eranthika
 
Automation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsAutomation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsQuontra Solutions
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Codemotion
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaAgile Testing Alliance
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: DemystifiedSeth McLaughlin
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)Sauce Labs
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at TiltDave King
 
Selenium testing
Selenium testingSelenium testing
Selenium testingJason Myers
 
Protractor end-to-end testing framework for angular js
Protractor   end-to-end testing framework for angular jsProtractor   end-to-end testing framework for angular js
Protractor end-to-end testing framework for angular jscodeandyou forums
 
Better End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorBetter End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorKasun Kodagoda
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScriptSimon Guest
 
Testing Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS CurriculumTesting Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS CurriculumBrian Jordan
 
Moving From a Selenium Grid to the Cloud - A Real Life Story
Moving From a Selenium Grid to the Cloud - A Real Life StoryMoving From a Selenium Grid to the Cloud - A Real Life Story
Moving From a Selenium Grid to the Cloud - A Real Life StorySauce Labs
 
Automation using Javascript
Automation using JavascriptAutomation using Javascript
Automation using Javascriptkhanhdang1214
 

Tendances (20)

Protractor for angularJS
Protractor for angularJSProtractor for angularJS
Protractor for angularJS
 
Automated testing with Drupal
Automated testing with DrupalAutomated testing with Drupal
Automated testing with Drupal
 
Protractor overview
Protractor overviewProtractor overview
Protractor overview
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
 
Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011Jellyfish, JSCONF 2011
Jellyfish, JSCONF 2011
 
How to Configure Selenium WebDriver (java)
How to Configure Selenium WebDriver (java)How to Configure Selenium WebDriver (java)
How to Configure Selenium WebDriver (java)
 
Automation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsAutomation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra Solutions
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: Demystified
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at Tilt
 
Selenium testing
Selenium testingSelenium testing
Selenium testing
 
Protractor end-to-end testing framework for angular js
Protractor   end-to-end testing framework for angular jsProtractor   end-to-end testing framework for angular js
Protractor end-to-end testing framework for angular js
 
Better End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using ProtractorBetter End-to-End Testing with Page Objects Model using Protractor
Better End-to-End Testing with Page Objects Model using Protractor
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
 
Testing Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS CurriculumTesting Code.org's Interactive CS Curriculum
Testing Code.org's Interactive CS Curriculum
 
Protractor
ProtractorProtractor
Protractor
 
Moving From a Selenium Grid to the Cloud - A Real Life Story
Moving From a Selenium Grid to the Cloud - A Real Life StoryMoving From a Selenium Grid to the Cloud - A Real Life Story
Moving From a Selenium Grid to the Cloud - A Real Life Story
 
Automation using Javascript
Automation using JavascriptAutomation using Javascript
Automation using Javascript
 

En vedette

En vedette (20)

A native american_welcome
A native american_welcomeA native american_welcome
A native american_welcome
 
Build my dream 4 opdracht 01
Build my dream 4 opdracht 01Build my dream 4 opdracht 01
Build my dream 4 opdracht 01
 
vAcademia 2015
vAcademia 2015vAcademia 2015
vAcademia 2015
 
Виртуальная образовательная среда vAcademia : модная игрушка или прорыв в e...
Виртуальная образовательная среда  vAcademia : модная игрушка или  прорыв в e...Виртуальная образовательная среда  vAcademia : модная игрушка или  прорыв в e...
Виртуальная образовательная среда vAcademia : модная игрушка или прорыв в e...
 
Bmd opdracht 5
Bmd opdracht 5Bmd opdracht 5
Bmd opdracht 5
 
Burns night
Burns nightBurns night
Burns night
 
Sequences
SequencesSequences
Sequences
 
Thanksgiving my activity
Thanksgiving my activityThanksgiving my activity
Thanksgiving my activity
 
E learning-2004
E learning-2004E learning-2004
E learning-2004
 
Bmd opdracht 2
Bmd opdracht 2Bmd opdracht 2
Bmd opdracht 2
 
Enforcing coding standards in a JS project
Enforcing coding standards in a JS projectEnforcing coding standards in a JS project
Enforcing coding standards in a JS project
 
Bmd 6 o1 show
Bmd 6 o1 showBmd 6 o1 show
Bmd 6 o1 show
 
Vacademia 31 10 2013 moscow
Vacademia 31 10 2013 moscow Vacademia 31 10 2013 moscow
Vacademia 31 10 2013 moscow
 
Scotland pic
Scotland picScotland pic
Scotland pic
 
BMD opdracht 1
BMD opdracht 1BMD opdracht 1
BMD opdracht 1
 
Halloween info
Halloween infoHalloween info
Halloween info
 
Bmd opdracht 6.1
Bmd opdracht 6.1Bmd opdracht 6.1
Bmd opdracht 6.1
 
Bmd opdracht 3 huis2
Bmd opdracht 3 huis2Bmd opdracht 3 huis2
Bmd opdracht 3 huis2
 
Bmd opdracht 2
Bmd opdracht 2Bmd opdracht 2
Bmd opdracht 2
 
How to make courseware for schools interesting
How to make courseware for schools interestingHow to make courseware for schools interesting
How to make courseware for schools interesting
 

Similaire à Getting started with Selenium 2

Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011camp_drupal_ua
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfAnuragMourya8
 
Test Automation Using Selenium
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using SeleniumNikhil Kapoor
 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...Simplilearn
 
Best Selenium Online Training
Best Selenium Online TrainingBest Selenium Online Training
Best Selenium Online TrainingSamatha Kamuni
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Simplilearn
 
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011Yuriy Gerasimov
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Edureka!
 
Testing world selenium_start_chapter1 (1)
Testing world selenium_start_chapter1 (1)Testing world selenium_start_chapter1 (1)
Testing world selenium_start_chapter1 (1)Testing World
 
前端網頁自動測試
前端網頁自動測試 前端網頁自動測試
前端網頁自動測試 政億 林
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Atirek Gupta
 
Selenium Web Driver Tutorial for Cross Browser Testing
Selenium Web Driver Tutorial for Cross Browser TestingSelenium Web Driver Tutorial for Cross Browser Testing
Selenium Web Driver Tutorial for Cross Browser TestingSarah Elson
 
Introduction to Selenium Automation
Introduction to Selenium AutomationIntroduction to Selenium Automation
Introduction to Selenium AutomationMindfire Solutions
 
Selenium -Test automation for web applications
Selenium -Test automation for web applicationsSelenium -Test automation for web applications
Selenium -Test automation for web applicationsAnisGhelissi
 

Similaire à Getting started with Selenium 2 (20)

Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdf
 
Test Automation Using Selenium
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using Selenium
 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Best Selenium Online Training
Best Selenium Online TrainingBest Selenium Online Training
Best Selenium Online Training
 
Introduction to selenium web driver
Introduction to selenium web driverIntroduction to selenium web driver
Introduction to selenium web driver
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
 
Selenium
SeleniumSelenium
Selenium
 
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
 
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
Selenium Tutorial For Beginners | What Is Selenium? | Selenium Automation Tes...
 
Testing world selenium_start_chapter1 (1)
Testing world selenium_start_chapter1 (1)Testing world selenium_start_chapter1 (1)
Testing world selenium_start_chapter1 (1)
 
前端網頁自動測試
前端網頁自動測試 前端網頁自動測試
前端網頁自動測試
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
 
Selenium Web Driver Tutorial for Cross Browser Testing
Selenium Web Driver Tutorial for Cross Browser TestingSelenium Web Driver Tutorial for Cross Browser Testing
Selenium Web Driver Tutorial for Cross Browser Testing
 
Introduction to Selenium Automation
Introduction to Selenium AutomationIntroduction to Selenium Automation
Introduction to Selenium Automation
 
Selenium
SeleniumSelenium
Selenium
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Selenium -Test automation for web applications
Selenium -Test automation for web applicationsSelenium -Test automation for web applications
Selenium -Test automation for web applications
 

Plus de Sebastiano Armeli

Managing a software engineering team
Managing a software engineering teamManaging a software engineering team
Managing a software engineering teamSebastiano Armeli
 
EcmaScript 6 - The future is here
EcmaScript 6 - The future is hereEcmaScript 6 - The future is here
EcmaScript 6 - The future is hereSebastiano Armeli
 
Dependency management & Package management in JavaScript
Dependency management & Package management in JavaScriptDependency management & Package management in JavaScript
Dependency management & Package management in JavaScriptSebastiano Armeli
 
MVC on the server and on the client
MVC on the server and on the clientMVC on the server and on the client
MVC on the server and on the clientSebastiano Armeli
 
Backbone.js in a real-life application
Backbone.js in a real-life applicationBackbone.js in a real-life application
Backbone.js in a real-life applicationSebastiano Armeli
 

Plus de Sebastiano Armeli (11)

Managing a software engineering team
Managing a software engineering teamManaging a software engineering team
Managing a software engineering team
 
Enforcing coding standards
Enforcing coding standardsEnforcing coding standards
Enforcing coding standards
 
ES6: The future is now
ES6: The future is nowES6: The future is now
ES6: The future is now
 
EcmaScript 6 - The future is here
EcmaScript 6 - The future is hereEcmaScript 6 - The future is here
EcmaScript 6 - The future is here
 
Dependency management & Package management in JavaScript
Dependency management & Package management in JavaScriptDependency management & Package management in JavaScript
Dependency management & Package management in JavaScript
 
Karma - JS Test Runner
Karma - JS Test RunnerKarma - JS Test Runner
Karma - JS Test Runner
 
RequireJS
RequireJSRequireJS
RequireJS
 
Lazy load Everything!
Lazy load Everything!Lazy load Everything!
Lazy load Everything!
 
MVC on the server and on the client
MVC on the server and on the clientMVC on the server and on the client
MVC on the server and on the client
 
Backbone.js in a real-life application
Backbone.js in a real-life applicationBackbone.js in a real-life application
Backbone.js in a real-life application
 
Web Storage
Web StorageWeb Storage
Web Storage
 

Dernier

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 

Dernier (20)

Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 

Getting started with Selenium 2

  • 1. Getting started with Selenium 2 Sebastiano Armeli-Battana @sebarmeli https://github.com/sebarmeli November 17 , 2011 Open Source Developers Conference, Canberra
  • 2. What is Selenium? Open Source Web Application Testing System Automated UI Testing Functional type of tests Multiple browsers, multiple languages
  • 3. History 2004 2007 2009 2011 Selenium WebDriver Selenium 2
  • 5. Selenium Selenium Core : JavaScript Framework
  • 6. Selenium Selenium Core : JavaScript Framework - IDE Firefox Plugin
  • 7. Selenium Selenium Core : JavaScript Framework - IDE Firefox Plugin - Remote Control (RC) Server : Proxy to launch browsers Client libraries
  • 8. Selenium Selenium Core : JavaScript Framework - IDE Firefox Plugin - Remote Control (RC) Server : Proxy to launch browsers Client libraries - Grid Distributed remote tests
  • 9. WebDriver “Best fit” language Clean & Object Oriented API HtmlUnitDriver Java bindings
  • 10. Selenium 2 - IDE - Web Driver Bindings : Java, C#, Python, Ruby WebDriver API Simplified Architecture Selenium Server NOT needed * - Grid 2
  • 11. Selenium Server Replicate Selenium RC functionalities Selenium Grid 2
  • 12. First steps Java / C# bindings Selenium Server Android APK http://code.google.com/p/selenium/downloads/list Chrome Driver http://code.google.com/p/chromium/downloads/list Ruby gem install selenium-webdriver Python pip install selenium / easy_install selenium
  • 14. Locator Strategies • Id webDriver.findElement(By.id("logo")); • Name webDriver.findElement(By.name("q")); • Tag Name webDriver.findElement(By.tagName("H1")); • Class name webDriver.findElements(By.className("sponsor_logos")); • CSS Selector webDriver.findElement(By.cssSelector("section#sponsor>p")); • XPath webDriver.findElement(By.xpath("//section[@id=‘miniconfs’]/a[2]")); • Link Text webDriver.findElements(By.linkText("About")); • Partial Link Text webDriver.findElement(By.partialLinkText("visitcanberra"));
  • 16. AJAX applications DOM Elements loaded asynchronously a) Polling the DOM for n seconds webDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); (Java) webDriver.manage.timeouts.implicit_wait = 30 (Ruby) webDriver.implicit_wait(30) (Python) b) Wait until condition occurs ExpectedCondition / WebDriverWait
  • 17. Testing style and executing JS Testing CSS properties webElement.getCssValue(“height”); webElement.getCssValue(“background-image”); Javascript execution JavascriptExecutor js = (JavascriptExecutor) webDriver; Long value = (Long) js.executeScript("return window.scrollY");
  • 18. TargetLocator and Navigation Interfaces TargetLocator Frames and Popup Dialogs TargetLocator target = webDriver.switchTo(); WebElement element = target.frame(“name”) Alert alert = target.alert(); Navigation Browser buttons emulation Navigation nav = webDriver.navigate(); nav.back(); / nav.forward(); nav.to(“url”);
  • 19. Migrating from Selenium 1 Selenium selenium = new WebDriverBackedSelenium(webDriver, “http://osdc.com.au”); selenium.open("http://osdc.com.au"); selenium.click("id=follow_twitter"); selenium.waitForPageToLoad("10000"); WebDriver webDriver = ((WebDriverBackedSelenium) selenium).getUnderlyingWebDriver();
  • 20. Page Object Pattern / PageFactory Pages as Objects Separation between DOM and services in a Page WebDriver API not exposed PageFactory class to easily instantiate a Page Object
  • 21. Selenium Grid 2 Starting Hub java -jar selenium-server-standalone-2.9.0.jar -role hub Starting WebDriver Node java -jar selenium-server-standalone-2.9.0.jar -role webdriver - hub http://localhost:4444/grid/register -browser browserName=chrome,version=15,platform=MAC -port 5556 Grid console http://localhost:4444/grid/console Launching Test Remotely (Java)
  • 23. Selenium 2 - Java QuickStart Archetype https://github.com/sebarmeli/Selenium2-Java-QuickStart-Archetype

Notes de l'éditeur

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n