SlideShare a Scribd company logo
UI Testing with Selenium and Node
​Keir Bowden
​CTO, BrightGen
​keirbowden@brightgen.com
​@bob_buzzard
​
Selenium
​Automates Browsers
• That's it!
​Primary use case is testing
• Typically brittle and non-comprehensive
• Covers a lot of bases
WebDriver
Remote control interface
Introspection and control of user agent
Platform and language neutral
Test framework agnostic
Local or remote server
selenium-webdriver
​Node module
Official Selenium implementation
• 4.0.0-alpha.1
Other implementations are available - e.g. webdriver.io
Demo
Login to Salesforce
Promise Manager
Looks synchronous :
Promise Manager
Is not synchronous
Promise Manager
Resolve promises
Key Functions
WebDriver.get(<url>)
• Opens URL in remote control browser
WebDriver.wait(until.<condition>, <timeout>)
• waits for something, for <timeout> millseconds
WebDriver.findElement(By.<mechanism>)
• Locates element on page
• By - name, className, id, css, xpath
Key Functions
WebElement.sendKeys(<key sequence>)
• Types key sequence in DOM element
• Modifier keys are supported (SHIFT, CONTROL, ALT, META)
WebElement.click()
• Clicks on a DOM element
WebElement.findElement(By.<mechanism>)
• Locates descendant element
Demo
Create an opportunity
https://medium.com/rate-engineering/a-guide-to-working-with-shadow-dom-using-selenium-b124992559f
Web Components - Shadow DOM
Not accessible via
webdriver.findElement()
Shadow Host
shadowHost = driver.findElement(...);
driver.executeScript("return arguments[0].shadowRoot",
shadowHost);
Lightning Web Components
Nothing!
Does not use native shadow DOM - yet!
Tests will break after switch
Demo
Lightning Web Component
Search Contacts
Key Takeaways (1)
Add one item at a time
Test after each item
Keep scenarios short
Use modules
Baby Steps!
Key Takeaways (2)
Use XPath
//label/span[contains(text(), "Opportunity Name")]/../../input
//label - any descendant node containing a label
/span - containing a span
[contains(text() - whose text contains
/../.. - whose grandparent node
"Opportunity Name"] - this string literal
/input - contains an input element
XPath
<div ... >
<label ...>
<span ...>Opportunity Name</span>
<span ...>*</span>
</label>
<input ...>
</div>
XPath
Test in Browser
Useful Links
bobbuzz.me.uk/selenium - Selenium HQ
bobbuzz.me.uk/2GPuDVS - selenium-webdriver node package
bobbuzz.me.uk/LC2019Repo - Example repo from this talk
bobbuzz.me.uk/2SIISTP - Selenium and the Shadow DOM
Q & A
Thank You
​Keir Bowden
​CTO, BrightGen
​keirbowden@brightgen.com
​@bob_buzzard
​
Remember to tell us what you think in the event survey
www.LondonsCalling.net/survey/

More Related Content

What's hot (20)

PPSX
Selenium RC
ANKUR-BA
 
PPTX
Selenium tutorials
Ducat
 
PPT
Selenium 2: The Future of Selenium is now!
AutomatedTester
 
PDF
Python Testing 101 with Selenium
Leonardo Jimenez
 
PPSX
Selenium - Introduction
ANKUR-BA
 
PPTX
Selenium WebDriver
Yuriy Bezgachnyuk
 
PPT
Selenium
Ruturaj Doshi
 
PPT
Selenium
Sun Technlogies
 
PPT
Selenium
Daksh Sharma
 
PDF
Selenium WebDriver: Tips and Tricks
Edureka!
 
PDF
Practical Tips & Tricks for Selenium Test Automation
Sauce Labs
 
ODP
Mastering selenium for automated acceptance tests
Nick Belhomme
 
PPTX
Selenium Topic 2 IDE
ITProfessional Academy
 
PPTX
Test Automation and Selenium
Karapet Sarkisyan
 
PPTX
Selenide vs. Selenium: The War Of Technologies
BugRaptors
 
PDF
Web UI test automation instruments
Artem Nagornyi
 
PPT
Selenium slide
Charlotte Charl
 
PDF
Basics of Selenium IDE,Core, Remote Control
usha kannappan
 
PPTX
Smarter ways to do selenium automation @ work, Selenium, automation
RIA RUI Society
 
PPTX
Automatically test in WebEx11
showgoodjiang
 
Selenium RC
ANKUR-BA
 
Selenium tutorials
Ducat
 
Selenium 2: The Future of Selenium is now!
AutomatedTester
 
Python Testing 101 with Selenium
Leonardo Jimenez
 
Selenium - Introduction
ANKUR-BA
 
Selenium WebDriver
Yuriy Bezgachnyuk
 
Selenium
Ruturaj Doshi
 
Selenium
Sun Technlogies
 
Selenium
Daksh Sharma
 
Selenium WebDriver: Tips and Tricks
Edureka!
 
Practical Tips & Tricks for Selenium Test Automation
Sauce Labs
 
Mastering selenium for automated acceptance tests
Nick Belhomme
 
Selenium Topic 2 IDE
ITProfessional Academy
 
Test Automation and Selenium
Karapet Sarkisyan
 
Selenide vs. Selenium: The War Of Technologies
BugRaptors
 
Web UI test automation instruments
Artem Nagornyi
 
Selenium slide
Charlotte Charl
 
Basics of Selenium IDE,Core, Remote Control
usha kannappan
 
Smarter ways to do selenium automation @ work, Selenium, automation
RIA RUI Society
 
Automatically test in WebEx11
showgoodjiang
 

Similar to UI Testing with Selenium and Node - London's Calling 2019 (20)

PPTX
Automated ui-testing
Slobodan Lohja
 
PPTX
Selenium
傑倫 鍾
 
PPT
Selenium Java for Beginners by Sujit Pathak
Software Testing Board
 
PDF
Test automation & Seleniun by oren rubin
Oren Rubin
 
PPTX
Selenium Automation
Pratyush Majumdar
 
PDF
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
Mek Srunyu Stittri
 
PPT
Selenium training in chennai
Thecreating Experts
 
PPTX
Selenium And Its Types
PriyanshuDutta2
 
PPTX
Web UI Tests: Introduce UI tests using Selenium
Peyman Fakharian
 
PPT
Selenium using C# by Yogesh Kumar
Software Testing Board
 
PPTX
Automated Web Testing With Selenium
Jodie Miners
 
PPTX
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
PPTX
Selenium training
Suresh Arora
 
PPTX
Get Started With Selenium 3 and Selenium 3 Grid
Daniel Herken
 
PPTX
Automated testing using Selenium & NUnit
Alfred Jett Grandeza
 
PDF
Node.js and Selenium Webdriver, a journey from the Java side
Mek Srunyu Stittri
 
PDF
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
PDF
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
PDF
Selenium web driver
Shobika Ramasubbarayalu
 
PDF
WebDriverIO Tutorial for Selenium Automation.pdf
kalichargn70th171
 
Automated ui-testing
Slobodan Lohja
 
Selenium
傑倫 鍾
 
Selenium Java for Beginners by Sujit Pathak
Software Testing Board
 
Test automation & Seleniun by oren rubin
Oren Rubin
 
Selenium Automation
Pratyush Majumdar
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
Mek Srunyu Stittri
 
Selenium training in chennai
Thecreating Experts
 
Selenium And Its Types
PriyanshuDutta2
 
Web UI Tests: Introduce UI tests using Selenium
Peyman Fakharian
 
Selenium using C# by Yogesh Kumar
Software Testing Board
 
Automated Web Testing With Selenium
Jodie Miners
 
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
Selenium training
Suresh Arora
 
Get Started With Selenium 3 and Selenium 3 Grid
Daniel Herken
 
Automated testing using Selenium & NUnit
Alfred Jett Grandeza
 
Node.js and Selenium Webdriver, a journey from the Java side
Mek Srunyu Stittri
 
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
Selenium web driver
Shobika Ramasubbarayalu
 
WebDriverIO Tutorial for Selenium Automation.pdf
kalichargn70th171
 
Ad

More from Keir Bowden (20)

PDF
LC 2022 - Second Generation Packaging
Keir Bowden
 
PDF
Mutation Testing.pdf
Keir Bowden
 
PDF
London Non-Profit Spring 22 Salesforce Release
Keir Bowden
 
PDF
London Salesforce Developer January 2022
Keir Bowden
 
PDF
Winter 22 for Developers
Keir Bowden
 
PDF
Londons Calling 2021
Keir Bowden
 
PPTX
London Salesforce Developers TDX 20 Global Gathering
Keir Bowden
 
PDF
Helsinki developer group march 2020
Keir Bowden
 
PDF
London's calling 2020 Documentor Plug-In
Keir Bowden
 
PDF
Lightning User Interface Testing with Selenium and Node JS
Keir Bowden
 
PDF
Salesforce CLI Cheat Sheet
Keir Bowden
 
PDF
Salesforce Spring 19 release top 10 Features
Keir Bowden
 
PPTX
Salesforce Winter 19 release top 10 features
Keir Bowden
 
PDF
Quickstart Templates with the Salesforce CLI
Keir Bowden
 
PDF
TrailheaDX Global Gathering London 2018
Keir Bowden
 
PDF
Getting started with public speaking
Keir Bowden
 
PDF
Salesforce CLI
Keir Bowden
 
PPTX
London's Calling 2018 - No Connection, No Problem
Keir Bowden
 
PPTX
No Connection? No Problem!
Keir Bowden
 
PDF
Unit Testing Lightning Components with Jasmine
Keir Bowden
 
LC 2022 - Second Generation Packaging
Keir Bowden
 
Mutation Testing.pdf
Keir Bowden
 
London Non-Profit Spring 22 Salesforce Release
Keir Bowden
 
London Salesforce Developer January 2022
Keir Bowden
 
Winter 22 for Developers
Keir Bowden
 
Londons Calling 2021
Keir Bowden
 
London Salesforce Developers TDX 20 Global Gathering
Keir Bowden
 
Helsinki developer group march 2020
Keir Bowden
 
London's calling 2020 Documentor Plug-In
Keir Bowden
 
Lightning User Interface Testing with Selenium and Node JS
Keir Bowden
 
Salesforce CLI Cheat Sheet
Keir Bowden
 
Salesforce Spring 19 release top 10 Features
Keir Bowden
 
Salesforce Winter 19 release top 10 features
Keir Bowden
 
Quickstart Templates with the Salesforce CLI
Keir Bowden
 
TrailheaDX Global Gathering London 2018
Keir Bowden
 
Getting started with public speaking
Keir Bowden
 
Salesforce CLI
Keir Bowden
 
London's Calling 2018 - No Connection, No Problem
Keir Bowden
 
No Connection? No Problem!
Keir Bowden
 
Unit Testing Lightning Components with Jasmine
Keir Bowden
 
Ad

Recently uploaded (20)

PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 

UI Testing with Selenium and Node - London's Calling 2019