際際滷

際際滷Share a Scribd company logo
www.fg.cz
Selenium Webdriver
Michal Franc - @michalfranc
2
O em bude e?
Testov叩n鱈 UI webov辿 aplikace
End to End testy
Funkn鱈 / akceptan鱈 testy
N叩hrada run鱈ch test哲 - automatizace
3
Co je Selenium Webdriver
Webdriver
W3C specifikace protokolu pro vzd叩len辿 ovl叩d叩n鱈
prohl鱈転ee - http://www.w3.org/TR/webdriver/
Selenium Webdriver 2.0
N叩stupce Selenium RC
Poskytuje API pro webdriver
Java
JavaScript
Python
Ruby
C#
4
Alternativn鱈 n叩stroje
Sahi (JS,Java,Ruby)
http://sahipro.com/
CasperJS (JS)
http://casperjs.org/
WATIR (Ruby)
http://watir.com/
Capybara (Ruby)
https://github.com/jnicklas/capybara
5
Z叩kladn鱈 顎一叩噛一温
6
API  p鱈stup k DOM
org.openqa.selenium.SearchContext
org.openqa.selenium.By
7
API  ek叩n鱈 na DOM
org.openqa.selenium.support.ui.WebDriverWait
8
Ped prvn鱈m testem
Co vlastn testovat a jak辿 testy?
Simulujeme u転ivatele (testera)
Testovac鱈 sc辿n叩
Re叩ln辿 workflow
9
PageObject pattern
Pozor na rychl箪 za叩tek
Nedlejte to!
10
PageObject pattern
C鱈l  vytvoit vrstvu nad obsahem na str叩nce
org.openqa.selenium.support.PageFactory
org.openqa.selenium.support.FindBy
11
PageObject pattern
12
PageObject pattern  roz邸鱈it na komponenty
13
PageObject pattern - komponenty
Str叩nku rozlo転it na mal辿 komponenty
14
PageObject pattern - komponenty
15
Re叩ln箪 test - 顎一叩噛一温
16
JUnit - Organizace test哲 - Suite
17
JUnit  Organizace test哲 - Rule
18
Selenium Server
Vzd叩len箪 browser
org.openqa.selenium.remote.RemoteWebDriver
org.openqa.selenium.remote.DesiredCapabilities
Infrastruktura
V鱈ce browser哲 v r哲zn箪ch verz鱈ch
V鱈ce syst辿m哲
Virtualizace vs licence windows
19
BrowserStack Automate
Selenium Grid infrastruktura
Podporovan辿 prohl鱈転ee a syst辿my
FF, Chrome, IE, Opera, Safari
Windows XP, 7, 8, 8.1 / Mac OS X Snow Leopard, Lion,
Mountain Lion, Mavericks, Yosemite / Android / iOS
https://www.browserstack.com/list-of-browsers-and-
platforms?product=automate
20
BrowserStack Automate
21
Continuous Integration
Build pipeline
Change -> Commit -> Compile -> Unit tests -> Deploy to
test server -> IT tests -> UI test
22
Probl辿my
Stabilita
Kontrola pedpoklad哲  fail fast
DOM  StaleElementException
Postrann鱈 info
P鱈prava prosted鱈
Testovac鱈 data
Paralelizace
Implementace WebDriver
Rozd鱈ly mezi prohl鱈転ei
Nkdy nutn辿 dlat o邸kliv辿 vci
Sv叩d鱈 ke zneu転it鱈
23
Dotazy
24
@michalfranc
@EdeeCMS
www.edee-cms.cz
www.fg.cz

More Related Content

Viewers also liked (12)

Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
Naresh Chintalcheru
Vyu転it鱈 NodeJS pro Javisty - jOpenSpace 2014
Vyu転it鱈 NodeJS pro Javisty - jOpenSpace 2014Vyu転it鱈 NodeJS pro Javisty - jOpenSpace 2014
Vyu転it鱈 NodeJS pro Javisty - jOpenSpace 2014
Michal Franc
Selenium intro
Selenium introSelenium intro
Selenium intro
David Stark
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
Prasad Sawant
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
Java Collections Framework
Java  Collections  FrameworkJava  Collections  Framework
Java Collections Framework
guestd8c458
Java exception handling ppt
Java exception handling pptJava exception handling ppt
Java exception handling ppt
JavabynataraJ
Exception handling
Exception handlingException handling
Exception handling
Abhishek Pachisia
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
vivek_prahlad
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
Pavan Kumar
Manual testing interview question by INFOTECH
Manual testing interview question by INFOTECHManual testing interview question by INFOTECH
Manual testing interview question by INFOTECH
Pravinsinh
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
Naresh Chintalcheru
Vyu転it鱈 NodeJS pro Javisty - jOpenSpace 2014
Vyu転it鱈 NodeJS pro Javisty - jOpenSpace 2014Vyu転it鱈 NodeJS pro Javisty - jOpenSpace 2014
Vyu転it鱈 NodeJS pro Javisty - jOpenSpace 2014
Michal Franc
Selenium intro
Selenium introSelenium intro
Selenium intro
David Stark
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
Prasad Sawant
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
Java Collections Framework
Java  Collections  FrameworkJava  Collections  Framework
Java Collections Framework
guestd8c458
Java exception handling ppt
Java exception handling pptJava exception handling ppt
Java exception handling ppt
JavabynataraJ
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
vivek_prahlad
Manual testing interview question by INFOTECH
Manual testing interview question by INFOTECHManual testing interview question by INFOTECH
Manual testing interview question by INFOTECH
Pravinsinh

Similar to Selenium Webdriver - jOpenSpace 2015 (20)

Trendy a nov辿 mo転nosti test automation
Trendy a nov辿 mo転nosti test automationTrendy a nov辿 mo転nosti test automation
Trendy a nov辿 mo転nosti test automation
Ondej Machulda
20110511 V箪voj software - produktivn, efektivn, kvalitn
20110511 V箪voj software - produktivn, efektivn, kvalitn20110511 V箪voj software - produktivn, efektivn, kvalitn
20110511 V箪voj software - produktivn, efektivn, kvalitn
Ji鱈 Mare邸
Pedstaven鱈 Ruby on Rails
Pedstaven鱈 Ruby on RailsPedstaven鱈 Ruby on Rails
Pedstaven鱈 Ruby on Rails
igloonet
2009 X33EJA Modern鱈 Technologie Pro V箪voj JEE
2009 X33EJA Modern鱈 Technologie Pro V箪voj JEE2009 X33EJA Modern鱈 Technologie Pro V箪voj JEE
2009 X33EJA Modern鱈 Technologie Pro V箪voj JEE
Martin Pt叩ek
WordPress REST API + React + TypeScript
WordPress REST API + React + TypeScriptWordPress REST API + React + TypeScript
WordPress REST API + React + TypeScript
Borek Bernard
2007 Technologie Pro Tvorbu Java Enterprise Aplikac鱈
2007 Technologie Pro Tvorbu Java Enterprise Aplikac鱈2007 Technologie Pro Tvorbu Java Enterprise Aplikac鱈
2007 Technologie Pro Tvorbu Java Enterprise Aplikac鱈
Martin Pt叩ek
atoto.cz - jak na snadnou integraci Codeception
atoto.cz - jak na snadnou integraci Codeceptionatoto.cz - jak na snadnou integraci Codeception
atoto.cz - jak na snadnou integraci Codeception
atotocz
2011 X33EJA V箪konov辿 Aspekty JEE Monitoring a optimalizace
2011 X33EJA V箪konov辿 Aspekty JEE Monitoring a optimalizace2011 X33EJA V箪konov辿 Aspekty JEE Monitoring a optimalizace
2011 X33EJA V箪konov辿 Aspekty JEE Monitoring a optimalizace
Martin Pt叩ek
INPTP Rekapitulace
INPTP Rekapitulace INPTP Rekapitulace
INPTP Rekapitulace
Jan H鱈del
ASP.NET MVC
ASP.NET MVCASP.NET MVC
ASP.NET MVC
danielkolman
ASP.NET MVC a TDD
ASP.NET MVC a TDDASP.NET MVC a TDD
ASP.NET MVC a TDD
danielkolman
Petr Nikolas Prokop - Symfony framework (0. sraz p叩tel Symfony v Hradci Kr叩l...
Petr Nikolas Prokop - Symfony framework (0. sraz p叩tel Symfony v Hradci Kr叩l...Petr Nikolas Prokop - Symfony framework (0. sraz p叩tel Symfony v Hradci Kr叩l...
Petr Nikolas Prokop - Symfony framework (0. sraz p叩tel Symfony v Hradci Kr叩l...
永辿鞄叩沿一温庄
vSphere automation workshop python
vSphere automation workshop pythonvSphere automation workshop python
vSphere automation workshop python
Vladan Laxa
Pro chcete testovat sv辿 aplikace
Pro chcete testovat sv辿 aplikacePro chcete testovat sv辿 aplikace
Pro chcete testovat sv辿 aplikace
atotocz
Trendy a nov辿 mo転nosti test automation
Trendy a nov辿 mo転nosti test automationTrendy a nov辿 mo転nosti test automation
Trendy a nov辿 mo転nosti test automation
Ondej Machulda
20110511 V箪voj software - produktivn, efektivn, kvalitn
20110511 V箪voj software - produktivn, efektivn, kvalitn20110511 V箪voj software - produktivn, efektivn, kvalitn
20110511 V箪voj software - produktivn, efektivn, kvalitn
Ji鱈 Mare邸
Pedstaven鱈 Ruby on Rails
Pedstaven鱈 Ruby on RailsPedstaven鱈 Ruby on Rails
Pedstaven鱈 Ruby on Rails
igloonet
2009 X33EJA Modern鱈 Technologie Pro V箪voj JEE
2009 X33EJA Modern鱈 Technologie Pro V箪voj JEE2009 X33EJA Modern鱈 Technologie Pro V箪voj JEE
2009 X33EJA Modern鱈 Technologie Pro V箪voj JEE
Martin Pt叩ek
WordPress REST API + React + TypeScript
WordPress REST API + React + TypeScriptWordPress REST API + React + TypeScript
WordPress REST API + React + TypeScript
Borek Bernard
2007 Technologie Pro Tvorbu Java Enterprise Aplikac鱈
2007 Technologie Pro Tvorbu Java Enterprise Aplikac鱈2007 Technologie Pro Tvorbu Java Enterprise Aplikac鱈
2007 Technologie Pro Tvorbu Java Enterprise Aplikac鱈
Martin Pt叩ek
atoto.cz - jak na snadnou integraci Codeception
atoto.cz - jak na snadnou integraci Codeceptionatoto.cz - jak na snadnou integraci Codeception
atoto.cz - jak na snadnou integraci Codeception
atotocz
2011 X33EJA V箪konov辿 Aspekty JEE Monitoring a optimalizace
2011 X33EJA V箪konov辿 Aspekty JEE Monitoring a optimalizace2011 X33EJA V箪konov辿 Aspekty JEE Monitoring a optimalizace
2011 X33EJA V箪konov辿 Aspekty JEE Monitoring a optimalizace
Martin Pt叩ek
INPTP Rekapitulace
INPTP Rekapitulace INPTP Rekapitulace
INPTP Rekapitulace
Jan H鱈del
ASP.NET MVC a TDD
ASP.NET MVC a TDDASP.NET MVC a TDD
ASP.NET MVC a TDD
danielkolman
Petr Nikolas Prokop - Symfony framework (0. sraz p叩tel Symfony v Hradci Kr叩l...
Petr Nikolas Prokop - Symfony framework (0. sraz p叩tel Symfony v Hradci Kr叩l...Petr Nikolas Prokop - Symfony framework (0. sraz p叩tel Symfony v Hradci Kr叩l...
Petr Nikolas Prokop - Symfony framework (0. sraz p叩tel Symfony v Hradci Kr叩l...
永辿鞄叩沿一温庄
vSphere automation workshop python
vSphere automation workshop pythonvSphere automation workshop python
vSphere automation workshop python
Vladan Laxa
Pro chcete testovat sv辿 aplikace
Pro chcete testovat sv辿 aplikacePro chcete testovat sv辿 aplikace
Pro chcete testovat sv辿 aplikace
atotocz

Selenium Webdriver - jOpenSpace 2015

Editor's Notes

  • #6: WebDriver driver = new HtmlUnitDriver(); WebDriver driver = new ChromeDriver(); WebDriver driver = new InternetExplorerDriver(); WebDriver driver = new FirefoxDriver(); // And now use this to visit Google driver.get("http://www.google.com"); // Find the text input element by its name WebElement element = driver.findElement(By.name("q")); // Enter something to search for element.sendKeys("Cheese!"); // Now submit the form. WebDriver will find the form for us from the element element.submit(); // Check the title of the page System.out.println("Page title is: " + driver.getTitle()); driver.quit();
  • #7: By.id(domId) By.className(cssClass) By.cssSelector(w3Selector) By.name(nameAttr) By.tagName(tagName) By.xpath(xpathExpression) By.linkText(anchorTagText)
  • #8: public WebElement waitUntilElementIsVisible(final By elementSpecifiedBy, final SearchContext ctx) { new WebDriverWait(driver,timeout) .ignoring(StaleElementReferenceException.class) .until( new ExpectedCondition<Boolean>() { public Boolean apply(WebDriver d) { return ctx.findElement(elementSpecifiedBy).isDisplayed(); } } ); return ctx.findElement(elementSpecifiedBy); }
  • #13: PageObject nutn辿 roz邸鱈it na komponenty, strom je komponenta, wysiwyg je komponenta, toolbar je komponenta .
  • #20: Alternativy browserstack.com saucelabs.com testingbot.com
  • #22: Alternativy browserstack.com saucelabs.com testingbot.com
  • #23: Alternativy browserstack.com saucelabs.com testingbot.com
  • #24: Alternativy browserstack.com saucelabs.com testingbot.com