SlideShare a Scribd company logo
Automated UI Testing with
Selenium WebDriver
Automated UI Testing with Selenium
CollabSphere 2018 Sponsors
Automated UI Testing with Selenium
Slobodan Lohja
Full stack developer focus on open
source technologies.
Working with Domino since version
4.5.
Fan of enterprise Java, XPages, Spring
and Hibernate.
I learned to enjoy enterprise java
development over the years.
Agenda
• Introduction
• Workstation Setup
• Project hands on
• Tips
Automated UI Testing with Selenium
• Manual Testers
• Test Engineers
• Managers
• Automation Engineer
Introduction – Who is it for?
Automated UI Testing with Selenium
• Tool that covers multiple browsers across
platforms.
• Supports many Programming languages
• Can simulate a user case and validate
check points
• Open Source free of cost
Introduction – Why Selenium
Automated UI Testing with Selenium
Selenium IDE
• Record and Play
• Does not scale on large projects
• Only used with Firefox.
Selenium RC
• Supports multiple OS, browsers and languages
• Works on any browser that supports Javascript.
• JavaScript injection can be blocked in some
browsers
• Deprecated by Selenium Web Driver
Introduction – Selenium Components
Automated UI Testing with Selenium
Selenium WebDriver
• JavaScript injection removed.
• Supports multiple OS, browsers and languages
• No Server needed
• iOS and Android support
• Interacts with browser native code
Selenium Grid – Parallel/Sequential Execution
• Designed to distribute test cases to many
machines
Introduction – Selenium Components
Automated UI Testing with Selenium
Each browser manufacturer produces
a WebDriver
Introduction – WebDriver
WebDriver
Interface
(APIs)
Firefox
Driver
Safari
Driver
Chrome
Driver
Others
User
Code
Automated UI Testing with Selenium
Agenda
• Introduction
• Workstation Setup
• Project hands on
• Tips
Automated UI Testing with Selenium
• Java SE Development Kit (JDK)
• Eclipse IDE (Maven included)
• WebDrivers for each browser
• Selenium WebDriver Jar libraries
• “Try Xpath” Firefox Add On
Workstation Setup
Automated UI Testing with Selenium
• https://www.seleniumhq.org/download/
• Save Selenium Java JARS into c:libsselenium
• Save WebDrivers to a common directory
c:webdrivers
Workstation Setup - WebDriver Links
Automated UI Testing with Selenium
Agenda
• Introduction
• Workstation Setup
• Project hands on
• Tips
Automated UI Testing with Selenium
package com.xpagesbeast.test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class TestSuite {
public static void main(String[] args) {
WebDriver driver;
System.setProperty("webdriver.gecko.driver", "/webdrivers/geckodriver.exe");
driver = new FirefoxDriver();
String baseURL = "http://www.google.com";
driver.get(baseURL);
}
}
Project Hands On – Simple proof of concept
Automated UI Testing with Selenium
Project Hands On – Simple proof of concept
Find html elements by these attributes:
• Id
• Name
• Class Name
• XPath
• Link Text
• Partial Link Text
• Tag Name
• CSS Selector
Automated UI Testing with Selenium
Project Hands On – Advanced CSS Selectors
Find html elements by these attributes:
• Tag[attribute=‘value’]
• .class1.class2.class3 append until we find
an element
Automated UI Testing with Selenium
Project Hands On – Advanced CSS Selectors
Find html elements by these wildcards:
“^” represents the starting text
“$” represents the ending text
“*” represents the text contained
Example:
Tag[attribute<wildcard>=‘value’]
Input[class^=‘requiredInput’]
Automated UI Testing with Selenium
Project Hands On – Advanced CSS Selectors
Find child html elements:
“>” children
Example:
tag>tag
fieldset>input
Fieldset>input#name
Automated UI Testing with Selenium
Project Hands On – XPath Selectors
Find child html elements:
• Sing ‘/’ look inside the parent (relative)
• Double ‘//’ look for any child or nested children element inside
the parent.
//tag[@attribute=‘value’
//tag[text()=‘value’] -> Find based on text in between tag.
Example:
.//*[#id=‘navbar’]
Tip: Once you find the element, replace ‘*’ with proper tag.
Automated UI Testing with Selenium
Agenda
• Introduction
• Workstation Setup
• Project hands on
• Tips
Automated UI Testing with Selenium
• Selenium WebDriver --‐> 3.0.1
• Gecko Driver --‐>0.11.1
• FF --‐> 49.0.2
• If you get errors, check your versions are
compatible.
Tips
Automated UI Testing with Selenium
• java.lang.IllegalStateException:
The path to the driver executable must be set by
the webdriver.gecko.driver system poperty;
Tips
Automated UI Testing with Selenium
System.setProperty("webdriver.gecko.driver",
"/webdrivers/geckodriver.exe");
Every Java program that starts launches its own
JVM instance (process). The System.Property is a
HashMap (key value pair). There is one for every
JVM Instance (one for every Java process).
Tips
Automated UI Testing with Selenium
Driver.findElement(By.tagName(“a”)).click();
Hardly used, finds first <a /> tag and clicks it in
the DOM.
Opposite with the By Id methods gives an error if
there is more than one found.
Tips
Automated UI Testing with Selenium
Slobodan Lohja
Blog: uxdesign.xpagesbeast.com
Email: slohja@hotmail.com
LinkedIn: linkedin.com/in/slobodanlohja/
Twitter: @xpagesbeast
Automated UI Testing with Selenium

More Related Content

PPTX
CollabSphere 2018 - Java in Domino After XPages
PPTX
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
PPTX
Selenium
PDF
IBM Think Session 8598 Domino and JavaScript Development MasterClass
PPT
watir-webdriver
PPTX
Selenium Automation at Incapsula
PDF
Testing Code.org's Interactive CS Curriculum
PDF
Afrimadoni the power of docker
CollabSphere 2018 - Java in Domino After XPages
CollabSphere SC 103 : Domino on the Web : Yes, It's (Probably) Hackable
Selenium
IBM Think Session 8598 Domino and JavaScript Development MasterClass
watir-webdriver
Selenium Automation at Incapsula
Testing Code.org's Interactive CS Curriculum
Afrimadoni the power of docker

What's hot (20)

PPTX
PHP Indonesia - Nodejs Web Development
PDF
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
PDF
Case study: JBoss Developer Studio, an IDE for Web, Mobile and Cloud applicat...
PPT
Dockerizing BDD : Ruby-Cucumber Example
PDF
IBM Connect 2014 BP204: It's Not Infernal: Dante's Nine Circles of XPages Heaven
PPT
Testing Java Web Apps With Selenium
PPTX
OpenNTF Webinar May 2021 - Jesse
PPTX
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
PPTX
Dockercon EU 2015
PDF
Hack & Fix, Hands on ColdFusion Security Training
PPTX
Play! Framework for JavaEE Developers
PPTX
Selenium-Grid-Extras
PDF
Session on Selenium Powertools by Unmesh Gundecha
PDF
2013 10-28 php ug presentation - ci using phing and hudson
PDF
Using CI for continuous delivery Part 1
PPTX
PDF
Continuous Updating with VersionEye at code.talks 2014
PDF
Using Play Framework 2 in production
PDF
Don Wibier
PPTX
CubeJS: eBay’s Node.js Adoption Journey
PHP Indonesia - Nodejs Web Development
IBM ConnectED 2015 - BP106 From XPages Hero To OSGi Guru: Taking The Scary Ou...
Case study: JBoss Developer Studio, an IDE for Web, Mobile and Cloud applicat...
Dockerizing BDD : Ruby-Cucumber Example
IBM Connect 2014 BP204: It's Not Infernal: Dante's Nine Circles of XPages Heaven
Testing Java Web Apps With Selenium
OpenNTF Webinar May 2021 - Jesse
CollabSphere 2021 - DEV114 - The Nuts and Bolts of CI/CD With a Large XPages ...
Dockercon EU 2015
Hack & Fix, Hands on ColdFusion Security Training
Play! Framework for JavaEE Developers
Selenium-Grid-Extras
Session on Selenium Powertools by Unmesh Gundecha
2013 10-28 php ug presentation - ci using phing and hudson
Using CI for continuous delivery Part 1
Continuous Updating with VersionEye at code.talks 2014
Using Play Framework 2 in production
Don Wibier
CubeJS: eBay’s Node.js Adoption Journey
Ad

Similar to Automated ui-testing (20)

PPTX
Automated software testing using Selenium WebDriver
ODP
Integrating Selenium testing infrastructure into Scala Project
PPTX
Selenium
PDF
Selenium Automation Testing - A Complete Guide
PPTX
Selenium Automation
PDF
Selenium Automation Testing - A Complete Guide.pdf
PPTX
Selenium web driver
PDF
Selenium Automation Testing - A Complete Guide.pdf
PPT
Selenium testing - Handle Elements in WebDriver
PDF
Web UI test automation instruments
PDF
Intelligent Testing Tool: Selenium Web Driver
PDF
Selenide
PPTX
Step by step - Selenium 3 web-driver - From Scratch
PPTX
Automated Web Testing With Selenium
PPTX
Web UI Tests: Introduce UI tests using Selenium
PDF
Web driver selenium simplified
PPTX
Selenium web driver
PPT
Selenium
PPTX
Test automation using selenium
PDF
An Overview of Selenium Grid and Its Benefits
Automated software testing using Selenium WebDriver
Integrating Selenium testing infrastructure into Scala Project
Selenium
Selenium Automation Testing - A Complete Guide
Selenium Automation
Selenium Automation Testing - A Complete Guide.pdf
Selenium web driver
Selenium Automation Testing - A Complete Guide.pdf
Selenium testing - Handle Elements in WebDriver
Web UI test automation instruments
Intelligent Testing Tool: Selenium Web Driver
Selenide
Step by step - Selenium 3 web-driver - From Scratch
Automated Web Testing With Selenium
Web UI Tests: Introduce UI tests using Selenium
Web driver selenium simplified
Selenium web driver
Selenium
Test automation using selenium
An Overview of Selenium Grid and Its Benefits
Ad

More from Slobodan Lohja (7)

PDF
Intro to SpringBatch NoSQL 2021
PPTX
Domino on docker version 2
PPTX
Enable Domino Data Access Services (DAS)
PPTX
JSF ActionListeners with XPages and Java Debugging XPages
PPTX
How to adopt team development and source control rev2
PPTX
Domino on docker version 1
PDF
Git for IBM Notes Designer
Intro to SpringBatch NoSQL 2021
Domino on docker version 2
Enable Domino Data Access Services (DAS)
JSF ActionListeners with XPages and Java Debugging XPages
How to adopt team development and source control rev2
Domino on docker version 1
Git for IBM Notes Designer

Recently uploaded (20)

PDF
A Day in the Life of Location Data - Turning Where into How.pdf
PDF
Software Development Methodologies in 2025
PDF
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
PDF
Google’s NotebookLM Unveils Video Overviews
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
PDF
Smarter Business Operations Powered by IoT Remote Monitoring
PDF
Test Bank, Solutions for Java How to Program, An Objects-Natural Approach, 12...
PDF
Top Generative AI Tools for Patent Drafting in 2025.pdf
PDF
Why Endpoint Security Is Critical in a Remote Work Era?
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
PDF
Doc9.....................................
PDF
agentic-ai-and-the-future-of-autonomous-systems.pdf
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
PDF
creating-agentic-ai-solutions-leveraging-aws.pdf
PPTX
ChatGPT's Deck on The Enduring Legacy of Fax Machines
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PPTX
How Much Does It Cost to Build a Train Ticket App like Trenitalia in Italy.pptx
A Day in the Life of Location Data - Turning Where into How.pdf
Software Development Methodologies in 2025
How Onsite IT Support Drives Business Efficiency, Security, and Growth.pdf
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Google’s NotebookLM Unveils Video Overviews
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Smarter Business Operations Powered by IoT Remote Monitoring
Test Bank, Solutions for Java How to Program, An Objects-Natural Approach, 12...
Top Generative AI Tools for Patent Drafting in 2025.pdf
Why Endpoint Security Is Critical in a Remote Work Era?
madgavkar20181017ppt McKinsey Presentation.pdf
Doc9.....................................
agentic-ai-and-the-future-of-autonomous-systems.pdf
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
creating-agentic-ai-solutions-leveraging-aws.pdf
ChatGPT's Deck on The Enduring Legacy of Fax Machines
GamePlan Trading System Review: Professional Trader's Honest Take
How Much Does It Cost to Build a Train Ticket App like Trenitalia in Italy.pptx

Automated ui-testing

  • 1. Automated UI Testing with Selenium WebDriver Automated UI Testing with Selenium
  • 3. Automated UI Testing with Selenium Slobodan Lohja Full stack developer focus on open source technologies. Working with Domino since version 4.5. Fan of enterprise Java, XPages, Spring and Hibernate. I learned to enjoy enterprise java development over the years.
  • 4. Agenda • Introduction • Workstation Setup • Project hands on • Tips Automated UI Testing with Selenium
  • 5. • Manual Testers • Test Engineers • Managers • Automation Engineer Introduction – Who is it for? Automated UI Testing with Selenium
  • 6. • Tool that covers multiple browsers across platforms. • Supports many Programming languages • Can simulate a user case and validate check points • Open Source free of cost Introduction – Why Selenium Automated UI Testing with Selenium
  • 7. Selenium IDE • Record and Play • Does not scale on large projects • Only used with Firefox. Selenium RC • Supports multiple OS, browsers and languages • Works on any browser that supports Javascript. • JavaScript injection can be blocked in some browsers • Deprecated by Selenium Web Driver Introduction – Selenium Components Automated UI Testing with Selenium
  • 8. Selenium WebDriver • JavaScript injection removed. • Supports multiple OS, browsers and languages • No Server needed • iOS and Android support • Interacts with browser native code Selenium Grid – Parallel/Sequential Execution • Designed to distribute test cases to many machines Introduction – Selenium Components Automated UI Testing with Selenium
  • 9. Each browser manufacturer produces a WebDriver Introduction – WebDriver WebDriver Interface (APIs) Firefox Driver Safari Driver Chrome Driver Others User Code Automated UI Testing with Selenium
  • 10. Agenda • Introduction • Workstation Setup • Project hands on • Tips Automated UI Testing with Selenium
  • 11. • Java SE Development Kit (JDK) • Eclipse IDE (Maven included) • WebDrivers for each browser • Selenium WebDriver Jar libraries • “Try Xpath” Firefox Add On Workstation Setup Automated UI Testing with Selenium
  • 12. • https://www.seleniumhq.org/download/ • Save Selenium Java JARS into c:libsselenium • Save WebDrivers to a common directory c:webdrivers Workstation Setup - WebDriver Links Automated UI Testing with Selenium
  • 13. Agenda • Introduction • Workstation Setup • Project hands on • Tips Automated UI Testing with Selenium
  • 14. package com.xpagesbeast.test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class TestSuite { public static void main(String[] args) { WebDriver driver; System.setProperty("webdriver.gecko.driver", "/webdrivers/geckodriver.exe"); driver = new FirefoxDriver(); String baseURL = "http://www.google.com"; driver.get(baseURL); } } Project Hands On – Simple proof of concept Automated UI Testing with Selenium
  • 15. Project Hands On – Simple proof of concept Find html elements by these attributes: • Id • Name • Class Name • XPath • Link Text • Partial Link Text • Tag Name • CSS Selector Automated UI Testing with Selenium
  • 16. Project Hands On – Advanced CSS Selectors Find html elements by these attributes: • Tag[attribute=‘value’] • .class1.class2.class3 append until we find an element Automated UI Testing with Selenium
  • 17. Project Hands On – Advanced CSS Selectors Find html elements by these wildcards: “^” represents the starting text “$” represents the ending text “*” represents the text contained Example: Tag[attribute<wildcard>=‘value’] Input[class^=‘requiredInput’] Automated UI Testing with Selenium
  • 18. Project Hands On – Advanced CSS Selectors Find child html elements: “>” children Example: tag>tag fieldset>input Fieldset>input#name Automated UI Testing with Selenium
  • 19. Project Hands On – XPath Selectors Find child html elements: • Sing ‘/’ look inside the parent (relative) • Double ‘//’ look for any child or nested children element inside the parent. //tag[@attribute=‘value’ //tag[text()=‘value’] -> Find based on text in between tag. Example: .//*[#id=‘navbar’] Tip: Once you find the element, replace ‘*’ with proper tag. Automated UI Testing with Selenium
  • 20. Agenda • Introduction • Workstation Setup • Project hands on • Tips Automated UI Testing with Selenium
  • 21. • Selenium WebDriver --‐> 3.0.1 • Gecko Driver --‐>0.11.1 • FF --‐> 49.0.2 • If you get errors, check your versions are compatible. Tips Automated UI Testing with Selenium
  • 22. • java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.gecko.driver system poperty; Tips Automated UI Testing with Selenium
  • 23. System.setProperty("webdriver.gecko.driver", "/webdrivers/geckodriver.exe"); Every Java program that starts launches its own JVM instance (process). The System.Property is a HashMap (key value pair). There is one for every JVM Instance (one for every Java process). Tips Automated UI Testing with Selenium
  • 24. Driver.findElement(By.tagName(“a”)).click(); Hardly used, finds first <a /> tag and clicks it in the DOM. Opposite with the By Id methods gives an error if there is more than one found. Tips Automated UI Testing with Selenium
  • 25. Slobodan Lohja Blog: uxdesign.xpagesbeast.com Email: [email protected] LinkedIn: linkedin.com/in/slobodanlohja/ Twitter: @xpagesbeast Automated UI Testing with Selenium

Editor's Notes

  • #6: Manual Testers = who want to switch to automated testing to become a test engineer Test Engineers = Managers = if you manage developers or quality assurance teams. Career change, want to become a Automation Engineer.
  • #7: Automate on Mac, Linux, and Windows Automate in Java, Python, PHP, Ruby (flexibility) – designed for Java, and this demo is on Java
  • #8: Selenium RC tries to overcome the limitations of Selenium IDE It’s deprecated by Selenium Web Driver, Javascript injection is blocked in some browsers. Automate in Java, Python, PHP, Ruby (flexibility) – designed for Java, and this demo is on Java Future is Selenium Web Driver
  • #9: Selenium RC tries to overcome the limitations of Selenium IDE It’s deprecated by Selenium Web Driver, Javascript injection is blocked in some browsers. Automate in Java, Python, PHP, Ruby (flexibility) – designed for Java, and this demo is on Java Future is Selenium Web Driver
  • #10: Java or Python code is written against the API and the driver uses the native browser code to test the UI. Code written once against all browsers, they follow the API.
  • #12: Maven is included in the latest Eclipse
  • #13: Maven is included in the latest Eclipse
  • #22: Maven is included in the latest Eclipse
  • #23: Maven is included in the latest Eclipse
  • #24: Maven is included in the latest Eclipse
  • #25: Maven is included in the latest Eclipse