SlideShare a Scribd company logo
1 of 13
Automation with Selenium 
Presented By 
Quontra Solutions 
IT Courses Online Training 
Call Us: 20-3734-1498 
Email: info@quontrasolutions.co.uk
Selenium 
You can’t be good at everything 
 How Selenium Remote Control works 
 You launch a server on your test machine. 
 Your tests connect to that server via IP. 
 The server launches a browser, with selenium CORE 
embedded as javascript into the page. 
 Selenium CORE simulates user actions with javascript.
The javascript sandbox 
The Good The Bad 
 Doesn’t steal your 
mouse/keyboard. 
 Works with any browser 
that uses javascript 
 Works for any OS that 
supports java. 
 Very fast page interactions. 
 Large API 
 Supports a variety of 
programming languages. 
 Can be run on remote 
machines 
• Can’t see anything 
outside the page object. 
• Not all browsers 
support all 
functionality. 
• Some pages aren’t 
automatable. 
• Can’t see inside third 
party apps 
• XSS Limitations
WebDriver Introduction 
 A different way of automating the browser. 
 Create a browser-specific driver to control the browser directly. 
 Have to do this for each browser! 
 Object oriented API 
 Doesn’t need a real browser 
 No javascript limitations 
 No need for a server. 
 Isn’t as delicate as selenium.
Selenium 2 
 Went into Beta Dec 24th. 
 WebDriver + Selenium 
 The two projects have merged (literally) into Selenium 2.0 
 Large browser support and no javascript limitations. 
 No server 
 The old API’s are still available. 
 New API’s are becoming available.
Automating with Selenium 2 
You have 2 options: 
 IWebDriver 
 This is just the WebDriver api 
 Doesn’t support a lot of browsers. 
 Will need to change all your tests. 
 WebDriverBackedSelenium 
 Uses the old Selenium 1 API 
 But uses WebDriver to run things if possible 
 Can use selenium 1 if the browser isn’t supported.
The WebDriver API 
 Object Oriented 
 Doesn’t break nearly as often 
 Handles pageloads automatically 
 Fewer problems automating 
 Somewhat more complicated API 
 selenium.type(“password”,”thisIsMyPassword”); 
 driver.findElement(By.id("password")).sendKeys(“thisIsMyPa 
ssword"); 
 By.Id, By.Xpath, By.Name, By.ClassName, By.PartialLinkText 
 All the supported browsers work really well 
 Can extend the API to add custom functionality. 
Works well with a Page Object design model.
Page Object Design Pattern 
 Adds a layer of abstraction into your code. 
 Helps to organize your code once it grows large. 
 All automation is automatically reusable and shareable. 
 A way to separate tests from re-usable functions. 
 A way to store information about how the system works. 
 A way to specify what page functions start on, and what page they end 
on. 
 A way to programmatically break your tests when functionality 
changes. 
Makes code maintenance easier. 
 There is even a PageFactory class available to automatically create 
them.
How does it work? 
 Each page is defined as it’s own class. 
 Actions (including navigation) are represented as functions for a class. 
 Each function returns a new Page object, signifying what page the actions 
stops on. 
 Your tests “know” what page you are on, and will only give you access to 
functions available to that class. 
 Tests only talk to the page objects. 
 Page objects only talk to the driver. 
 Elements on the page are stored as variables for the page object. 
 Automatic page validations can be stored in the constructor for each page 
object. 
 Tests become a string of well defined functions, not meaningless gibberish. 
 Tests can be grouped by namespace. 
 Class Inheritance can be used to define functionality to a set of pages. 
 We can make functional logic transparent to the tests by returning different 
inherited classes.
Bad Tests 
globalVars.logDescription = "log in"; 
globalVars.selenium.Open(globalVars.mobiUrl); 
functions.type("userId", globalVars.studName + "1"); 
functions.type("password", globalVars.studPass + "1"); 
functions.clickAndWait("signInBtn"); 
selenium.click("//a[@id='discussions']/span"); 
selenium.click("//a[@id='thingsToKnow']/span"); 
globalVars.logDescription = "Checking elements on happenings:by date page"; 
selenium.waitForElementNotVisible("//div[@id='THSContainer']//span[@class='ajaxLoadingHeader']"); 
selenium.waitForElementVisible("//div[@id='THSContainer']/ul[1]/li[1]"); 
selenium.click("//div[@id='THSContainer']//span[@class='replytext']"); 
selenium.click("backButton"); 
selenium.waitForElementVisible("//div[@id='TTHContainer']/ul[1]/li[1]"); 
selenium.click("//div[@id='TTHContainer']//span[@class='replytext']"); 
selenium.click("backButton"); 
globalVars.selenium.Select("byDateFilter", "label=Things Happening Soon"); 
selenium.waitForElementVisible("//div[@id='THSContainer']/ul[1]/li[1]"); 
selenium.click("//div[@id='THSContainer']//span[@class='replytext']"); 
selenium.click("backButton"); 
globalVars.selenium.Select("byDateFilter", "label=Things That Happened");
Better Tests 
[Test] 
public void testByDateTab() 
{ 
funtions.loginMobi(); 
selenium.click("//a[@id='discussions']/span"); 
selenium.click("//a[@id='thingsToKnow']/span"); 
functions.verifyThingsToKnow(); 
functions.verifyThingsHappeningSoon(); 
selenium.Select("byDateFilter", "label=Things That Happened"); 
functions.verifyThingsThatHappened(); 
}
Good Tests 
[Test] 
public void testByDateTab() 
{ 
selenium.Open(Moby_Common.MobyLoginUrl); 
LoginPage loginPage = new LoginPage(selenium); 
HappeningsPage happeningsPage = loginPage.loginAs(Common.stud1Name, 
Common.stud1Password); 
happeningsPage.waitToLoad(); 
Assert.That(!happeningsPage.isByTypePageLoaded()); 
Assert.That(happeningsPage.isByDatePageLoaded()); 
Assert.That(!happeningsPage.isByCoursePageLoaded()); 
happeningsPage.filterResults("byDateFilter","Things That Happened"); 
Assert.That(happeningsPage.isVisible("TTHContainer")); 
happeningsPage.filterResults("byDateFilter", "Things Happening Soon"); 
Assert.That(happeningsPage.isVisible("THSContainer")); 
happeningsPage.filterResults("byDateFilter", "All Types"); 
Assert.That(happeningsPage.isVisible("TTHContainer")); 
Assert.That(happeningsPage.isVisible("THSContainer")); 
}
The Page Object: 
public class HappeningsPage : WebPageBaseClass 
{ 
private string _loadingImage = 
"//span[@class='ajaxLoadingHeader']"; 
private string _moreLink = "more"; 
public HappeningsPage(ISelenium selenium) 
{ 
this.selenium = selenium; 
this.title = "Happenings"; 
this.url = "index.html"; 
assertPageLoadedCorrectly(); 
} 
public HappeningsPage waitToLoad() 
{ 
waitForElementNotVisible(_loadingImage ); 
return new HappeningsPage(selenium); 
} 
public ContentItemPage goToItem(string type, 
string name) 
{ 
click("//div[@id='" + type + 
"']//span[text()="" + name + ""]"); 
return new ContentItemPage(selenium); 
} 
public HappeningsPage clickMoreLink() 
{ 
click(_moreLink); 
return new HappeningsPage(selenium); 
} 
public HappeningsPage filterResults(string 
id, string name) 
{ 
selectDropdown(id, name); 
return new HappeningsPage(selenium); 
} 
}

More Related Content

What's hot

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
 
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web AppsSenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web AppsSencha
 
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
 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015Matt Raible
 
jQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and FuturejQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and FutureRichard Worth
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Andrew Eisenberg
 
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
 
Microsoft identity platform and device authorization flow to use azure servic...
Microsoft identity platform and device authorization flow to use azure servic...Microsoft identity platform and device authorization flow to use azure servic...
Microsoft identity platform and device authorization flow to use azure servic...Sunil kumar Mohanty
 
Angular js tutorial slides
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slidessamhelman
 
Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)Mindfire Solutions
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorCubet Techno Labs
 
Angular UI Testing with Protractor
Angular UI Testing with ProtractorAngular UI Testing with Protractor
Angular UI Testing with ProtractorAndrew Eisenberg
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at TiltDave King
 
Organized web app development using backbone.js
Organized web app development using backbone.jsOrganized web app development using backbone.js
Organized web app development using backbone.jsShakti Shrestha
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summaryAlan Richardson
 
Whys and Hows of Automation
Whys and Hows of AutomationWhys and Hows of Automation
Whys and Hows of AutomationvodQA
 

What's hot (20)

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
 
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web AppsSenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
SenchaCon 2016: Expect the Unexpected - Dealing with Errors in Web Apps
 
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
 
AngularJS is awesome
AngularJS is awesomeAngularJS is awesome
AngularJS is awesome
 
The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015The Art of AngularJS in 2015 - Angular Summit 2015
The Art of AngularJS in 2015 - Angular Summit 2015
 
jQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and FuturejQuery 1.9 and 2.0 - Present and Future
jQuery 1.9 and 2.0 - Present and Future
 
Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015Protractor Tutorial Quality in Agile 2015
Protractor Tutorial Quality in Agile 2015
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
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
 
Microsoft identity platform and device authorization flow to use azure servic...
Microsoft identity platform and device authorization flow to use azure servic...Microsoft identity platform and device authorization flow to use azure servic...
Microsoft identity platform and device authorization flow to use azure servic...
 
Angular js tutorial slides
Angular js tutorial slidesAngular js tutorial slides
Angular js tutorial slides
 
Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)Introduction To Ruby Watir (Web Application Testing In Ruby)
Introduction To Ruby Watir (Web Application Testing In Ruby)
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using Protractor
 
Angular js
Angular jsAngular js
Angular js
 
You Know WebOS
You Know WebOSYou Know WebOS
You Know WebOS
 
Angular UI Testing with Protractor
Angular UI Testing with ProtractorAngular UI Testing with Protractor
Angular UI Testing with Protractor
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at Tilt
 
Organized web app development using backbone.js
Organized web app development using backbone.jsOrganized web app development using backbone.js
Organized web app development using backbone.js
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summary
 
Whys and Hows of Automation
Whys and Hows of AutomationWhys and Hows of Automation
Whys and Hows of Automation
 

Viewers also liked

Android testing-with-selenium-webdriver Online Training
Android testing-with-selenium-webdriver Online TrainingAndroid testing-with-selenium-webdriver Online Training
Android testing-with-selenium-webdriver Online TrainingNagendra Kumar
 
Selenium webdriver
Selenium webdriverSelenium webdriver
Selenium webdriversean_todd
 
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-online-training
Selenium-online-trainingSelenium-online-training
Selenium-online-trainingRaghav Arora
 
selenium training | selenium course | selenium video tutorial | selenium for ...
selenium training | selenium course | selenium video tutorial | selenium for ...selenium training | selenium course | selenium video tutorial | selenium for ...
selenium training | selenium course | selenium video tutorial | selenium for ...Nancy Thomas
 
Automation framework using selenium webdriver with java
Automation framework using selenium webdriver with javaAutomation framework using selenium webdriver with java
Automation framework using selenium webdriver with javaNarayanan Palani
 
Selenium interview questions
Selenium interview questionsSelenium interview questions
Selenium interview questionsgirichinna27
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answersITeLearn
 
Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questionsKuldeep Pawar
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Seleniumvivek_prahlad
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for seleniumapoorvams
 
How to Design a Successful Test Automation Strategy
How to Design a Successful Test Automation Strategy How to Design a Successful Test Automation Strategy
How to Design a Successful Test Automation Strategy Impetus Technologies
 
Software testing objective_types
Software testing objective_typesSoftware testing objective_types
Software testing objective_typessangeeswaran
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using SeleniumNaresh Chintalcheru
 

Viewers also liked (20)

Android testing-with-selenium-webdriver Online Training
Android testing-with-selenium-webdriver Online TrainingAndroid testing-with-selenium-webdriver Online Training
Android testing-with-selenium-webdriver Online Training
 
Selenium webdriver
Selenium webdriverSelenium webdriver
Selenium webdriver
 
Web driver training
Web driver trainingWeb driver training
Web driver training
 
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-online-training
Selenium-online-trainingSelenium-online-training
Selenium-online-training
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ'sSelenium WebDriver FAQ's
Selenium WebDriver FAQ's
 
selenium training | selenium course | selenium video tutorial | selenium for ...
selenium training | selenium course | selenium video tutorial | selenium for ...selenium training | selenium course | selenium video tutorial | selenium for ...
selenium training | selenium course | selenium video tutorial | selenium for ...
 
Automation framework using selenium webdriver with java
Automation framework using selenium webdriver with javaAutomation framework using selenium webdriver with java
Automation framework using selenium webdriver with java
 
SE Quiz
SE QuizSE Quiz
SE Quiz
 
Selenium interview questions
Selenium interview questionsSelenium interview questions
Selenium interview questions
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answers
 
Selenium Concepts
Selenium ConceptsSelenium Concepts
Selenium Concepts
 
Realtime selenium interview questions
Realtime selenium interview questionsRealtime selenium interview questions
Realtime selenium interview questions
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
 
Java Basics for selenium
Java Basics for seleniumJava Basics for selenium
Java Basics for selenium
 
How to Design a Successful Test Automation Strategy
How to Design a Successful Test Automation Strategy How to Design a Successful Test Automation Strategy
How to Design a Successful Test Automation Strategy
 
Software testing objective_types
Software testing objective_typesSoftware testing objective_types
Software testing objective_types
 
Automation Testing by Selenium Web Driver
Automation Testing by Selenium Web DriverAutomation Testing by Selenium Web Driver
Automation Testing by Selenium Web Driver
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 

Similar to Automation with Selenium Presented by Quontra Solutions

Automating with selenium2
Automating with selenium2Automating with selenium2
Automating with selenium2mindqqa
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersAjit Jadhav
 
Indic threads pune12-improve testing efficiency with selenium webdriver
Indic threads pune12-improve testing efficiency with selenium webdriverIndic threads pune12-improve testing efficiency with selenium webdriver
Indic threads pune12-improve testing efficiency with selenium webdriverIndicThreads
 
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
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with seleniumTzirla Rozental
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Puneet Kala
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfAnuragMourya8
 
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Simplilearn
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using JavaF K
 

Similar to Automation with Selenium Presented by Quontra Solutions (20)

Automating with selenium2
Automating with selenium2Automating with selenium2
Automating with selenium2
 
Selenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And AnswersSelenium Automation Testing Interview Questions And Answers
Selenium Automation Testing Interview Questions And Answers
 
Indic threads pune12-improve testing efficiency with selenium webdriver
Indic threads pune12-improve testing efficiency with selenium webdriverIndic threads pune12-improve testing efficiency with selenium webdriver
Indic threads pune12-improve testing efficiency with selenium webdriver
 
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
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Automation - web testing with selenium
Automation - web testing with seleniumAutomation - web testing with selenium
Automation - web testing with selenium
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdf
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Selenium (1) (1)
Selenium (1) (1)Selenium (1) (1)
Selenium (1) (1)
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
Selenium Interview Questions And Answers | Selenium Interview Questions | Sel...
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using Java
 
Selenium
SeleniumSelenium
Selenium
 

More from Quontra Solutions

Java Constructors with examples - Quontra Solutions
Java Constructors with examples  - Quontra SolutionsJava Constructors with examples  - Quontra Solutions
Java Constructors with examples - Quontra SolutionsQuontra Solutions
 
Oracle-12c Online Training by Quontra Solutions
 Oracle-12c Online Training by Quontra Solutions Oracle-12c Online Training by Quontra Solutions
Oracle-12c Online Training by Quontra SolutionsQuontra Solutions
 
Test Automation Framework Online Training by QuontraSolutions
Test Automation Framework Online Training by QuontraSolutionsTest Automation Framework Online Training by QuontraSolutions
Test Automation Framework Online Training by QuontraSolutionsQuontra Solutions
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsQuontra Solutions
 
DataMining and OLAP Technology Concepts Presented By Quontra Solutions
DataMining and OLAP Technology Concepts Presented By Quontra SolutionsDataMining and OLAP Technology Concepts Presented By Quontra Solutions
DataMining and OLAP Technology Concepts Presented By Quontra SolutionsQuontra Solutions
 
Network security by quontra solutions uk
Network security by quontra solutions ukNetwork security by quontra solutions uk
Network security by quontra solutions ukQuontra Solutions
 
Introduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsIntroduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsQuontra Solutions
 
Informatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
Informatica Metadata Exchange Frequently Asked Questions by Quontra SolutionsInformatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
Informatica Metadata Exchange Frequently Asked Questions by Quontra SolutionsQuontra Solutions
 
Informatica metadata exchange frequently asked questions by quontra solutions
Informatica metadata exchange frequently asked questions by quontra solutionsInformatica metadata exchange frequently asked questions by quontra solutions
Informatica metadata exchange frequently asked questions by quontra solutionsQuontra Solutions
 
Dataware house Introduction By Quontra Solutions
Dataware house Introduction By Quontra SolutionsDataware house Introduction By Quontra Solutions
Dataware house Introduction By Quontra SolutionsQuontra Solutions
 
Selenium overview ppt by quontra solutions
Selenium overview ppt by quontra solutionsSelenium overview ppt by quontra solutions
Selenium overview ppt by quontra solutionsQuontra Solutions
 

More from Quontra Solutions (12)

Java Constructors with examples - Quontra Solutions
Java Constructors with examples  - Quontra SolutionsJava Constructors with examples  - Quontra Solutions
Java Constructors with examples - Quontra Solutions
 
Oracle-12c Online Training by Quontra Solutions
 Oracle-12c Online Training by Quontra Solutions Oracle-12c Online Training by Quontra Solutions
Oracle-12c Online Training by Quontra Solutions
 
Test Automation Framework Online Training by QuontraSolutions
Test Automation Framework Online Training by QuontraSolutionsTest Automation Framework Online Training by QuontraSolutions
Test Automation Framework Online Training by QuontraSolutions
 
Enterprise java beans
Enterprise java beansEnterprise java beans
Enterprise java beans
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra Solutions
 
DataMining and OLAP Technology Concepts Presented By Quontra Solutions
DataMining and OLAP Technology Concepts Presented By Quontra SolutionsDataMining and OLAP Technology Concepts Presented By Quontra Solutions
DataMining and OLAP Technology Concepts Presented By Quontra Solutions
 
Network security by quontra solutions uk
Network security by quontra solutions ukNetwork security by quontra solutions uk
Network security by quontra solutions uk
 
Introduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsIntroduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutions
 
Informatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
Informatica Metadata Exchange Frequently Asked Questions by Quontra SolutionsInformatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
Informatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
 
Informatica metadata exchange frequently asked questions by quontra solutions
Informatica metadata exchange frequently asked questions by quontra solutionsInformatica metadata exchange frequently asked questions by quontra solutions
Informatica metadata exchange frequently asked questions by quontra solutions
 
Dataware house Introduction By Quontra Solutions
Dataware house Introduction By Quontra SolutionsDataware house Introduction By Quontra Solutions
Dataware house Introduction By Quontra Solutions
 
Selenium overview ppt by quontra solutions
Selenium overview ppt by quontra solutionsSelenium overview ppt by quontra solutions
Selenium overview ppt by quontra solutions
 

Recently uploaded

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxAmita Gupta
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 

Recently uploaded (20)

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 

Automation with Selenium Presented by Quontra Solutions

  • 1. Automation with Selenium Presented By Quontra Solutions IT Courses Online Training Call Us: 20-3734-1498 Email: info@quontrasolutions.co.uk
  • 2. Selenium You can’t be good at everything  How Selenium Remote Control works  You launch a server on your test machine.  Your tests connect to that server via IP.  The server launches a browser, with selenium CORE embedded as javascript into the page.  Selenium CORE simulates user actions with javascript.
  • 3. The javascript sandbox The Good The Bad  Doesn’t steal your mouse/keyboard.  Works with any browser that uses javascript  Works for any OS that supports java.  Very fast page interactions.  Large API  Supports a variety of programming languages.  Can be run on remote machines • Can’t see anything outside the page object. • Not all browsers support all functionality. • Some pages aren’t automatable. • Can’t see inside third party apps • XSS Limitations
  • 4. WebDriver Introduction  A different way of automating the browser.  Create a browser-specific driver to control the browser directly.  Have to do this for each browser!  Object oriented API  Doesn’t need a real browser  No javascript limitations  No need for a server.  Isn’t as delicate as selenium.
  • 5. Selenium 2  Went into Beta Dec 24th.  WebDriver + Selenium  The two projects have merged (literally) into Selenium 2.0  Large browser support and no javascript limitations.  No server  The old API’s are still available.  New API’s are becoming available.
  • 6. Automating with Selenium 2 You have 2 options:  IWebDriver  This is just the WebDriver api  Doesn’t support a lot of browsers.  Will need to change all your tests.  WebDriverBackedSelenium  Uses the old Selenium 1 API  But uses WebDriver to run things if possible  Can use selenium 1 if the browser isn’t supported.
  • 7. The WebDriver API  Object Oriented  Doesn’t break nearly as often  Handles pageloads automatically  Fewer problems automating  Somewhat more complicated API  selenium.type(“password”,”thisIsMyPassword”);  driver.findElement(By.id("password")).sendKeys(“thisIsMyPa ssword");  By.Id, By.Xpath, By.Name, By.ClassName, By.PartialLinkText  All the supported browsers work really well  Can extend the API to add custom functionality. Works well with a Page Object design model.
  • 8. Page Object Design Pattern  Adds a layer of abstraction into your code.  Helps to organize your code once it grows large.  All automation is automatically reusable and shareable.  A way to separate tests from re-usable functions.  A way to store information about how the system works.  A way to specify what page functions start on, and what page they end on.  A way to programmatically break your tests when functionality changes. Makes code maintenance easier.  There is even a PageFactory class available to automatically create them.
  • 9. How does it work?  Each page is defined as it’s own class.  Actions (including navigation) are represented as functions for a class.  Each function returns a new Page object, signifying what page the actions stops on.  Your tests “know” what page you are on, and will only give you access to functions available to that class.  Tests only talk to the page objects.  Page objects only talk to the driver.  Elements on the page are stored as variables for the page object.  Automatic page validations can be stored in the constructor for each page object.  Tests become a string of well defined functions, not meaningless gibberish.  Tests can be grouped by namespace.  Class Inheritance can be used to define functionality to a set of pages.  We can make functional logic transparent to the tests by returning different inherited classes.
  • 10. Bad Tests globalVars.logDescription = "log in"; globalVars.selenium.Open(globalVars.mobiUrl); functions.type("userId", globalVars.studName + "1"); functions.type("password", globalVars.studPass + "1"); functions.clickAndWait("signInBtn"); selenium.click("//a[@id='discussions']/span"); selenium.click("//a[@id='thingsToKnow']/span"); globalVars.logDescription = "Checking elements on happenings:by date page"; selenium.waitForElementNotVisible("//div[@id='THSContainer']//span[@class='ajaxLoadingHeader']"); selenium.waitForElementVisible("//div[@id='THSContainer']/ul[1]/li[1]"); selenium.click("//div[@id='THSContainer']//span[@class='replytext']"); selenium.click("backButton"); selenium.waitForElementVisible("//div[@id='TTHContainer']/ul[1]/li[1]"); selenium.click("//div[@id='TTHContainer']//span[@class='replytext']"); selenium.click("backButton"); globalVars.selenium.Select("byDateFilter", "label=Things Happening Soon"); selenium.waitForElementVisible("//div[@id='THSContainer']/ul[1]/li[1]"); selenium.click("//div[@id='THSContainer']//span[@class='replytext']"); selenium.click("backButton"); globalVars.selenium.Select("byDateFilter", "label=Things That Happened");
  • 11. Better Tests [Test] public void testByDateTab() { funtions.loginMobi(); selenium.click("//a[@id='discussions']/span"); selenium.click("//a[@id='thingsToKnow']/span"); functions.verifyThingsToKnow(); functions.verifyThingsHappeningSoon(); selenium.Select("byDateFilter", "label=Things That Happened"); functions.verifyThingsThatHappened(); }
  • 12. Good Tests [Test] public void testByDateTab() { selenium.Open(Moby_Common.MobyLoginUrl); LoginPage loginPage = new LoginPage(selenium); HappeningsPage happeningsPage = loginPage.loginAs(Common.stud1Name, Common.stud1Password); happeningsPage.waitToLoad(); Assert.That(!happeningsPage.isByTypePageLoaded()); Assert.That(happeningsPage.isByDatePageLoaded()); Assert.That(!happeningsPage.isByCoursePageLoaded()); happeningsPage.filterResults("byDateFilter","Things That Happened"); Assert.That(happeningsPage.isVisible("TTHContainer")); happeningsPage.filterResults("byDateFilter", "Things Happening Soon"); Assert.That(happeningsPage.isVisible("THSContainer")); happeningsPage.filterResults("byDateFilter", "All Types"); Assert.That(happeningsPage.isVisible("TTHContainer")); Assert.That(happeningsPage.isVisible("THSContainer")); }
  • 13. The Page Object: public class HappeningsPage : WebPageBaseClass { private string _loadingImage = "//span[@class='ajaxLoadingHeader']"; private string _moreLink = "more"; public HappeningsPage(ISelenium selenium) { this.selenium = selenium; this.title = "Happenings"; this.url = "index.html"; assertPageLoadedCorrectly(); } public HappeningsPage waitToLoad() { waitForElementNotVisible(_loadingImage ); return new HappeningsPage(selenium); } public ContentItemPage goToItem(string type, string name) { click("//div[@id='" + type + "']//span[text()="" + name + ""]"); return new ContentItemPage(selenium); } public HappeningsPage clickMoreLink() { click(_moreLink); return new HappeningsPage(selenium); } public HappeningsPage filterResults(string id, string name) { selectDropdown(id, name); return new HappeningsPage(selenium); } }