SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Page Objects with
Selenium WebDriver
Trójmiejska Grupa Testerska
Spotkanie #3
Marcin Wasilczyk, Oleksandr Perepelytsya
16-Apr-15 1
Commercial In Confidence & Proprietary, Kainos Software 2012
Agenda
 Automated Testing overview
 Selenium
 Page Object pattern
 Demo
 Konkurs (z nagrodami )
16-Apr-15 2
Commercial In Confidence & Proprietary, Kainos Software 2012
Automated Testing overview
16-Apr-15 3
• Reduces amount of manual testing
• Can be run frequently (e.g. every night/build)
• Save testers time and is a quick signal to the dev
team that something was broken recently (either
test or application)
• Requires effort to write them as reliable piece of
software
• Test code needs to be easy to maintain when
application changes
• The code should be as good as production code
Commercial In Confidence & Proprietary, Kainos Software 2012
Selenium
16-Apr-15 4
• Is Selenium a test framework? Nope!
• Selenium is a suite of tools that automate web
browsers
• Supports most of the browsers and operating systems
• Could be used for
• Automating boring web-based administration tasks
• Testing (when run by external test framework like NUnit)
• Two versions exist
• Selenium RC (Remote Control)
• Uses javascript ‘injection’ to control the browser
• not supported anymore
• Selenium WebDriver
• Uses browser’s native support for automation
Selenium Basic Concepts
IWebDriver instance lets you control the browser
ChromeDriver, InternetExplorerDriver, FirefoxDriver, etc...
IWebElement instance lets you operate the page element
IWebElement button =
driver.FindElement(By.ClassName(“PrimaryButton”));
button.Click();
WebDriverWait lets you wait for elements being loaded
var loadWait = new WebDriverWait(driver,
TimeSpan.FromSeconds(5));
loadWait.Until(ExpectedConditions.TitleIs(„My Dashboard“));
16-Apr-15 5
Page Object pattern
Create model of UI pages as objects
Reduces the amount of duplicated code
If you change anything in UI, fix will be applied only to one place
Encapsulation of Page Object internals
Client (e.g. NUnit test) will know only about services exposed as public
methods
Page Objects should return other Page Objects; examples:
var userPage = loginPage.LoginAs(“username”, “password”);
var loginPage = logoutPopup.Confirm();
Changing the id of the button you don’t need to change the test, only the
page object’s internals will be modified
16-Apr-15 6
Page Object pattern -
summary
Generally don't make assertions – these should be done in the test,
not in the Page Object
Need not represent an entire page
Different results for the same action are modelled as different
methods
var patientRecordPage =
dashboardPage.SimpleSearchForSinglePatientWith(searchText);
var dashboardPage =
dashboardPage.SimpleSearchForManyPatientsWith(searchText);
16-Apr-15 7
Page Object pattern -
example
public class LoginPage
{
private IWebDriver Driver { get; set; }
private IWebElement UserName { get; set; }
private IWebElement Password { get; set; }
private IWebElement LoginButton { get; set; }
public LoginPage(IWebDriver driver)
{
Driver = driver;
UserName = driver.FindElement(By....)
// initialization of the remaining elements
}
// methods like
public UserPage LoginAs(string username, string password) { ... }
}
16-Apr-15 8
Selenium – support of
“Page Object pattern”
PageFactory lets you automatically initialize elements defined in
Page Object (binding - action)
PageFactory.InitElements(driver, pageObject);
FindsBy attribute - automatically find elements on page (binding -
definition)
CacheLookup attribute – caches found element
[FindsBy(How = How.Id, Using = „userNameElement")]
[CacheLookup]
private IWebElement UserName { get; set; }
16-Apr-15 9
Selenium – support of
“Page Object pattern”
public class LoginPage
{
private IWebDriver Driver { get; set; }
[FindsBy(How = How.Id, Using = "ctl00_content_UserName")]
[CacheLookup]
private IWebElement UserName { get; set; }
// ... other fields with attributes applied...
public LoginPage(IWebDriver driver)
{
Driver = driver;
PageFactory.InitElements(this.Driver, this);
}
// methods like
public UserPage LoginAs(string username, string password) { ... }
} 16-Apr-15 10
Demo
16-Apr-15 11
Konkurs
Test Steps:
1. Navigate to Home page
2. Search for “laptop”
3. Click on 3 (third) element in the results list
4. Remember seller name and price
5. Add to bucket
6. Verify that item in the bucket has the same
seller and price
7. Remove item from bucket
8. Navigate to Home page
16-Apr-15 12
Questions?
16-Apr-15 13

Weitere ähnliche Inhalte

Was ist angesagt?

Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternSQALab
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScriptSimon Guest
 
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Applitools
 
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCUI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCJim Lane
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScriptSimon Guest
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing AutomationAgileEngine
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Mehdi Khalili
 
Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Joe Ferguson
 
Automation using Javascript
Automation using JavascriptAutomation using Javascript
Automation using Javascriptkhanhdang1214
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Cogapp
 
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
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instrumentsArtem Nagornyi
 
PHP Unit Testing in Yii
PHP Unit Testing in YiiPHP Unit Testing in Yii
PHP Unit Testing in YiiIlPeach
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular SlidesJim Lynch
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
 
Codeception presentation
Codeception presentationCodeception presentation
Codeception presentationAndrei Burian
 

Was ist angesagt? (20)

Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component Pattern
 
Automated Testing using JavaScript
Automated Testing using JavaScriptAutomated Testing using JavaScript
Automated Testing using JavaScript
 
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
Mastering UI automation at Scale: Key Lessons and Best Practices (By Fernando...
 
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLCUI Testing Automation - Alex Kalinovsky - CreamTec LLC
UI Testing Automation - Alex Kalinovsky - CreamTec LLC
 
Automated Web Testing using JavaScript
Automated Web Testing using JavaScriptAutomated Web Testing using JavaScript
Automated Web Testing using JavaScript
 
UI Testing Automation
UI Testing AutomationUI Testing Automation
UI Testing Automation
 
Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)Automated UI testing done right (DDDSydney)
Automated UI testing done right (DDDSydney)
 
Workshop - E2e tests with protractor
Workshop - E2e tests with protractorWorkshop - E2e tests with protractor
Workshop - E2e tests with protractor
 
Protractor training
Protractor trainingProtractor training
Protractor training
 
Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015
 
Automation using Javascript
Automation using JavascriptAutomation using Javascript
Automation using Javascript
 
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
Test-driven Development with Drupal and Codeception (DrupalCamp Brighton)
 
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
 
Web UI test automation instruments
Web UI test automation instrumentsWeb UI test automation instruments
Web UI test automation instruments
 
Selenium Overview
Selenium OverviewSelenium Overview
Selenium Overview
 
Protractor overview
Protractor overviewProtractor overview
Protractor overview
 
PHP Unit Testing in Yii
PHP Unit Testing in YiiPHP Unit Testing in Yii
PHP Unit Testing in Yii
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular Slides
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and Beyond
 
Codeception presentation
Codeception presentationCodeception presentation
Codeception presentation
 

Ähnlich wie Marcin Wasilczyk - Page objects with selenium

Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Iakiv Kramarenko
 
I one aolpage-test-2010
I one aolpage-test-2010I one aolpage-test-2010
I one aolpage-test-2010Nicholas Tang
 
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Ondřej Machulda
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsAbhijeet Vaikar
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETBen Hall
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium Zoe Gilbert
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullySpringPeople
 
Integrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectIntegrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectKnoldus Inc.
 
Slides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testingSlides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testingSwapnilNarayan
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Roy de Kleijn
 
Load Testing: See a Bigger Picture
Load Testing: See a Bigger PictureLoad Testing: See a Bigger Picture
Load Testing: See a Bigger PictureAlexander Podelko
 
Automation Abstractions: Page Objects and Beyond
Automation Abstractions: Page Objects and BeyondAutomation Abstractions: Page Objects and Beyond
Automation Abstractions: Page Objects and BeyondTechWell
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumLiraz Shay
 
Test Automation Framework Development Introduction
Test Automation Framework Development IntroductionTest Automation Framework Development Introduction
Test Automation Framework Development IntroductionGanuka Yashantha
 
Selenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applicationsqooxdoo
 
Hands On with Selenium and WebDriver
Hands On with Selenium and WebDriverHands On with Selenium and WebDriver
Hands On with Selenium and WebDriverTechWell
 

Ähnlich wie Marcin Wasilczyk - Page objects with selenium (20)

Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
I one aolpage-test-2010
I one aolpage-test-2010I one aolpage-test-2010
I one aolpage-test-2010
 
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
Workshop: Functional testing made easy with PHPUnit & Selenium (phpCE Poland,...
 
Good practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium testsGood practices for debugging Selenium and Appium tests
Good practices for debugging Selenium and Appium tests
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
Qa process
Qa processQa process
Qa process
 
Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium  Page Object Model and Implementation in Selenium
Page Object Model and Implementation in Selenium
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
Integrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectIntegrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala Project
 
Qa process
Qa processQa process
Qa process
 
Page object pattern
Page object patternPage object pattern
Page object pattern
 
Slides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testingSlides for Automation Testing or End to End testing
Slides for Automation Testing or End to End testing
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
 
Load Testing: See a Bigger Picture
Load Testing: See a Bigger PictureLoad Testing: See a Bigger Picture
Load Testing: See a Bigger Picture
 
Automation Abstractions: Page Objects and Beyond
Automation Abstractions: Page Objects and BeyondAutomation Abstractions: Page Objects and Beyond
Automation Abstractions: Page Objects and Beyond
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Test Automation Framework Development Introduction
Test Automation Framework Development IntroductionTest Automation Framework Development Introduction
Test Automation Framework Development Introduction
 
Selenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web ApplicationsSelenium RC: Automated Testing of Modern Web Applications
Selenium RC: Automated Testing of Modern Web Applications
 
Hands On with Selenium and WebDriver
Hands On with Selenium and WebDriverHands On with Selenium and WebDriver
Hands On with Selenium and WebDriver
 

Mehr von Trójmiejska Grupa Testerska

TGT#21 - Tester eksploracyjny, ostatni zawód na świecie. – Radosław Smilgin
TGT#21 - Tester eksploracyjny, ostatni zawód na świecie. – Radosław SmilginTGT#21 - Tester eksploracyjny, ostatni zawód na świecie. – Radosław Smilgin
TGT#21 - Tester eksploracyjny, ostatni zawód na świecie. – Radosław SmilginTrójmiejska Grupa Testerska
 
TGT#19 - Wszyscy jestesmy testerami - Michal Rabczuk
TGT#19 - Wszyscy jestesmy testerami - Michal RabczukTGT#19 - Wszyscy jestesmy testerami - Michal Rabczuk
TGT#19 - Wszyscy jestesmy testerami - Michal RabczukTrójmiejska Grupa Testerska
 
TGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
TGT#20 - Automated Tests Only For Testers - Kasper KulikowskiTGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
TGT#20 - Automated Tests Only For Testers - Kasper KulikowskiTrójmiejska Grupa Testerska
 
TGT#18 - End-to-end testing using Protractor - Jakub Raniszewski
TGT#18 - End-to-end testing using Protractor - Jakub RaniszewskiTGT#18 - End-to-end testing using Protractor - Jakub Raniszewski
TGT#18 - End-to-end testing using Protractor - Jakub RaniszewskiTrójmiejska Grupa Testerska
 
TGT#18 - BDD with The Three Amigos in API Testing - Julia Szarlej
TGT#18 - BDD with The Three Amigos in API Testing - Julia SzarlejTGT#18 - BDD with The Three Amigos in API Testing - Julia Szarlej
TGT#18 - BDD with The Three Amigos in API Testing - Julia SzarlejTrójmiejska Grupa Testerska
 
TGT#17 - Efektywne testy oprogramowania w środowisku Scrumowym - Marcin Kubecki
TGT#17 - Efektywne testy oprogramowania w środowisku Scrumowym - Marcin KubeckiTGT#17 - Efektywne testy oprogramowania w środowisku Scrumowym - Marcin Kubecki
TGT#17 - Efektywne testy oprogramowania w środowisku Scrumowym - Marcin KubeckiTrójmiejska Grupa Testerska
 
TGT#17 - RestApi testing tips and tricks: how to start testing api of your we...
TGT#17 - RestApi testing tips and tricks: how to start testing api of your we...TGT#17 - RestApi testing tips and tricks: how to start testing api of your we...
TGT#17 - RestApi testing tips and tricks: how to start testing api of your we...Trójmiejska Grupa Testerska
 
TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...
TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...
TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...Trójmiejska Grupa Testerska
 
TGT#16 - Rozmowa techniczna (short talk) - Waldemar Mozoła
TGT#16 - Rozmowa techniczna (short talk) - Waldemar MozołaTGT#16 - Rozmowa techniczna (short talk) - Waldemar Mozoła
TGT#16 - Rozmowa techniczna (short talk) - Waldemar MozołaTrójmiejska Grupa Testerska
 
TGT#16 - Sztuka projektowania testów - Agnieszka Garwolińska
TGT#16 - Sztuka projektowania testów - Agnieszka GarwolińskaTGT#16 - Sztuka projektowania testów - Agnieszka Garwolińska
TGT#16 - Sztuka projektowania testów - Agnieszka GarwolińskaTrójmiejska Grupa Testerska
 
TGT#15 - Piramida testów w praktyce (notatki z dyskusji)
TGT#15 - Piramida testów w praktyce (notatki z dyskusji)TGT#15 - Piramida testów w praktyce (notatki z dyskusji)
TGT#15 - Piramida testów w praktyce (notatki z dyskusji)Trójmiejska Grupa Testerska
 
TGT#15 - Testowanie w metodykach zwinnych czyli skąd testerzy wiedzą więcej o...
TGT#15 - Testowanie w metodykach zwinnych czyli skąd testerzy wiedzą więcej o...TGT#15 - Testowanie w metodykach zwinnych czyli skąd testerzy wiedzą więcej o...
TGT#15 - Testowanie w metodykach zwinnych czyli skąd testerzy wiedzą więcej o...Trójmiejska Grupa Testerska
 
TGT#14 - @Before – Nie będę automatyzować @After – No dobra, to nie jest taki...
TGT#14 - @Before – Nie będę automatyzować @After – No dobra, to nie jest taki...TGT#14 - @Before – Nie będę automatyzować @After – No dobra, to nie jest taki...
TGT#14 - @Before – Nie będę automatyzować @After – No dobra, to nie jest taki...Trójmiejska Grupa Testerska
 
TGT#14 - Case Study: Współpraca Testera i Product Ownera w zespole scrumowym ...
TGT#14 - Case Study: Współpraca Testera i Product Ownera w zespole scrumowym ...TGT#14 - Case Study: Współpraca Testera i Product Ownera w zespole scrumowym ...
TGT#14 - Case Study: Współpraca Testera i Product Ownera w zespole scrumowym ...Trójmiejska Grupa Testerska
 
TG#13 - Nie samym Selenium człowiek żyje, czyli jak tworzyć stabilne testy fu...
TG#13 - Nie samym Selenium człowiek żyje, czyli jak tworzyć stabilne testy fu...TG#13 - Nie samym Selenium człowiek żyje, czyli jak tworzyć stabilne testy fu...
TG#13 - Nie samym Selenium człowiek żyje, czyli jak tworzyć stabilne testy fu...Trójmiejska Grupa Testerska
 

Mehr von Trójmiejska Grupa Testerska (20)

Rafal prezentacja testowanie ai
Rafal prezentacja testowanie aiRafal prezentacja testowanie ai
Rafal prezentacja testowanie ai
 
Tgt 23 przemyslaw_pradzynski
Tgt 23 przemyslaw_pradzynskiTgt 23 przemyslaw_pradzynski
Tgt 23 przemyslaw_pradzynski
 
TGT#21 - Tester eksploracyjny, ostatni zawód na świecie. – Radosław Smilgin
TGT#21 - Tester eksploracyjny, ostatni zawód na świecie. – Radosław SmilginTGT#21 - Tester eksploracyjny, ostatni zawód na świecie. – Radosław Smilgin
TGT#21 - Tester eksploracyjny, ostatni zawód na świecie. – Radosław Smilgin
 
TGT#19 - Wszyscy jestesmy testerami - Michal Rabczuk
TGT#19 - Wszyscy jestesmy testerami - Michal RabczukTGT#19 - Wszyscy jestesmy testerami - Michal Rabczuk
TGT#19 - Wszyscy jestesmy testerami - Michal Rabczuk
 
TGT#20 - Ataki XSS - Robert Charewicz
TGT#20 - Ataki XSS - Robert CharewiczTGT#20 - Ataki XSS - Robert Charewicz
TGT#20 - Ataki XSS - Robert Charewicz
 
TGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
TGT#20 - Automated Tests Only For Testers - Kasper KulikowskiTGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
TGT#20 - Automated Tests Only For Testers - Kasper Kulikowski
 
TGT#20 - TGT in Numbers - Mateusz Radkiewicz
TGT#20 - TGT in Numbers - Mateusz RadkiewiczTGT#20 - TGT in Numbers - Mateusz Radkiewicz
TGT#20 - TGT in Numbers - Mateusz Radkiewicz
 
TGT#19 - 3 seconds or less - Piotr Liss
TGT#19 - 3 seconds or less - Piotr LissTGT#19 - 3 seconds or less - Piotr Liss
TGT#19 - 3 seconds or less - Piotr Liss
 
TGT#18 - End-to-end testing using Protractor - Jakub Raniszewski
TGT#18 - End-to-end testing using Protractor - Jakub RaniszewskiTGT#18 - End-to-end testing using Protractor - Jakub Raniszewski
TGT#18 - End-to-end testing using Protractor - Jakub Raniszewski
 
TGT#18 - BDD with The Three Amigos in API Testing - Julia Szarlej
TGT#18 - BDD with The Three Amigos in API Testing - Julia SzarlejTGT#18 - BDD with The Three Amigos in API Testing - Julia Szarlej
TGT#18 - BDD with The Three Amigos in API Testing - Julia Szarlej
 
TGT#17 - Efektywne testy oprogramowania w środowisku Scrumowym - Marcin Kubecki
TGT#17 - Efektywne testy oprogramowania w środowisku Scrumowym - Marcin KubeckiTGT#17 - Efektywne testy oprogramowania w środowisku Scrumowym - Marcin Kubecki
TGT#17 - Efektywne testy oprogramowania w środowisku Scrumowym - Marcin Kubecki
 
TGT#17 - RestApi testing tips and tricks: how to start testing api of your we...
TGT#17 - RestApi testing tips and tricks: how to start testing api of your we...TGT#17 - RestApi testing tips and tricks: how to start testing api of your we...
TGT#17 - RestApi testing tips and tricks: how to start testing api of your we...
 
TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...
TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...
TGT#16 - Pain of test automatization in PAAS/SAAS solutions - Krzysztof Lembi...
 
TGT#16 - Rozmowa techniczna (short talk) - Waldemar Mozoła
TGT#16 - Rozmowa techniczna (short talk) - Waldemar MozołaTGT#16 - Rozmowa techniczna (short talk) - Waldemar Mozoła
TGT#16 - Rozmowa techniczna (short talk) - Waldemar Mozoła
 
TGT#16 - Sztuka projektowania testów - Agnieszka Garwolińska
TGT#16 - Sztuka projektowania testów - Agnieszka GarwolińskaTGT#16 - Sztuka projektowania testów - Agnieszka Garwolińska
TGT#16 - Sztuka projektowania testów - Agnieszka Garwolińska
 
TGT#15 - Piramida testów w praktyce (notatki z dyskusji)
TGT#15 - Piramida testów w praktyce (notatki z dyskusji)TGT#15 - Piramida testów w praktyce (notatki z dyskusji)
TGT#15 - Piramida testów w praktyce (notatki z dyskusji)
 
TGT#15 - Testowanie w metodykach zwinnych czyli skąd testerzy wiedzą więcej o...
TGT#15 - Testowanie w metodykach zwinnych czyli skąd testerzy wiedzą więcej o...TGT#15 - Testowanie w metodykach zwinnych czyli skąd testerzy wiedzą więcej o...
TGT#15 - Testowanie w metodykach zwinnych czyli skąd testerzy wiedzą więcej o...
 
TGT#14 - @Before – Nie będę automatyzować @After – No dobra, to nie jest taki...
TGT#14 - @Before – Nie będę automatyzować @After – No dobra, to nie jest taki...TGT#14 - @Before – Nie będę automatyzować @After – No dobra, to nie jest taki...
TGT#14 - @Before – Nie będę automatyzować @After – No dobra, to nie jest taki...
 
TGT#14 - Case Study: Współpraca Testera i Product Ownera w zespole scrumowym ...
TGT#14 - Case Study: Współpraca Testera i Product Ownera w zespole scrumowym ...TGT#14 - Case Study: Współpraca Testera i Product Ownera w zespole scrumowym ...
TGT#14 - Case Study: Współpraca Testera i Product Ownera w zespole scrumowym ...
 
TG#13 - Nie samym Selenium człowiek żyje, czyli jak tworzyć stabilne testy fu...
TG#13 - Nie samym Selenium człowiek żyje, czyli jak tworzyć stabilne testy fu...TG#13 - Nie samym Selenium człowiek żyje, czyli jak tworzyć stabilne testy fu...
TG#13 - Nie samym Selenium człowiek żyje, czyli jak tworzyć stabilne testy fu...
 

Kürzlich hochgeladen

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 

Kürzlich hochgeladen (20)

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 

Marcin Wasilczyk - Page objects with selenium

  • 1. Page Objects with Selenium WebDriver Trójmiejska Grupa Testerska Spotkanie #3 Marcin Wasilczyk, Oleksandr Perepelytsya 16-Apr-15 1
  • 2. Commercial In Confidence & Proprietary, Kainos Software 2012 Agenda  Automated Testing overview  Selenium  Page Object pattern  Demo  Konkurs (z nagrodami ) 16-Apr-15 2
  • 3. Commercial In Confidence & Proprietary, Kainos Software 2012 Automated Testing overview 16-Apr-15 3 • Reduces amount of manual testing • Can be run frequently (e.g. every night/build) • Save testers time and is a quick signal to the dev team that something was broken recently (either test or application) • Requires effort to write them as reliable piece of software • Test code needs to be easy to maintain when application changes • The code should be as good as production code
  • 4. Commercial In Confidence & Proprietary, Kainos Software 2012 Selenium 16-Apr-15 4 • Is Selenium a test framework? Nope! • Selenium is a suite of tools that automate web browsers • Supports most of the browsers and operating systems • Could be used for • Automating boring web-based administration tasks • Testing (when run by external test framework like NUnit) • Two versions exist • Selenium RC (Remote Control) • Uses javascript ‘injection’ to control the browser • not supported anymore • Selenium WebDriver • Uses browser’s native support for automation
  • 5. Selenium Basic Concepts IWebDriver instance lets you control the browser ChromeDriver, InternetExplorerDriver, FirefoxDriver, etc... IWebElement instance lets you operate the page element IWebElement button = driver.FindElement(By.ClassName(“PrimaryButton”)); button.Click(); WebDriverWait lets you wait for elements being loaded var loadWait = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); loadWait.Until(ExpectedConditions.TitleIs(„My Dashboard“)); 16-Apr-15 5
  • 6. Page Object pattern Create model of UI pages as objects Reduces the amount of duplicated code If you change anything in UI, fix will be applied only to one place Encapsulation of Page Object internals Client (e.g. NUnit test) will know only about services exposed as public methods Page Objects should return other Page Objects; examples: var userPage = loginPage.LoginAs(“username”, “password”); var loginPage = logoutPopup.Confirm(); Changing the id of the button you don’t need to change the test, only the page object’s internals will be modified 16-Apr-15 6
  • 7. Page Object pattern - summary Generally don't make assertions – these should be done in the test, not in the Page Object Need not represent an entire page Different results for the same action are modelled as different methods var patientRecordPage = dashboardPage.SimpleSearchForSinglePatientWith(searchText); var dashboardPage = dashboardPage.SimpleSearchForManyPatientsWith(searchText); 16-Apr-15 7
  • 8. Page Object pattern - example public class LoginPage { private IWebDriver Driver { get; set; } private IWebElement UserName { get; set; } private IWebElement Password { get; set; } private IWebElement LoginButton { get; set; } public LoginPage(IWebDriver driver) { Driver = driver; UserName = driver.FindElement(By....) // initialization of the remaining elements } // methods like public UserPage LoginAs(string username, string password) { ... } } 16-Apr-15 8
  • 9. Selenium – support of “Page Object pattern” PageFactory lets you automatically initialize elements defined in Page Object (binding - action) PageFactory.InitElements(driver, pageObject); FindsBy attribute - automatically find elements on page (binding - definition) CacheLookup attribute – caches found element [FindsBy(How = How.Id, Using = „userNameElement")] [CacheLookup] private IWebElement UserName { get; set; } 16-Apr-15 9
  • 10. Selenium – support of “Page Object pattern” public class LoginPage { private IWebDriver Driver { get; set; } [FindsBy(How = How.Id, Using = "ctl00_content_UserName")] [CacheLookup] private IWebElement UserName { get; set; } // ... other fields with attributes applied... public LoginPage(IWebDriver driver) { Driver = driver; PageFactory.InitElements(this.Driver, this); } // methods like public UserPage LoginAs(string username, string password) { ... } } 16-Apr-15 10
  • 12. Konkurs Test Steps: 1. Navigate to Home page 2. Search for “laptop” 3. Click on 3 (third) element in the results list 4. Remember seller name and price 5. Add to bucket 6. Verify that item in the bucket has the same seller and price 7. Remove item from bucket 8. Navigate to Home page 16-Apr-15 12