SlideShare a Scribd company logo
1 of 4
Download to read offline
Moving from Selenium to Protractor for
Test Automation
Protractor is an end-to-end Testing Framework for testing Angular as well as AngularJS
applications. It helps you runs tests against your application running in a real browser,
interacting in exactly the same way a user would. The first version of Protractor was released
in the month of July 2013, when the framework was just a prototype of a particular testing
framework. Google, however, with the support of the testing community, is evolving the
framework to follow the evolution of AngularJS and to meet the needs of the community that
is using AngularJS.
Why use Protractor over Selenium?
Test Your Application like a User
Protractor framework is built on top of WebDriverJS, which uses native events and browser-
specific drivers to interact with your application exactly like a user would. It is based on
Behaviour Driven approach which allows even a non automation tester to test the application
without expertise in automation tool. Example –
describe(‘angularjs homepage’, function() {
it(‘should greet the named user’, function() {
// Load the AngularJS homepage.
browser.get(‘http://www.angularjs.org’);
element(by.model(‘yourName’)).sendKeys(‘Julie’);
var greeting = element(by.binding(‘yourName’));
// Used to assert that the text element has the required expected value.
// Protractor patches ‘expect’ to understand promises.
expect(greeting.getText()).toEqual(‘Hello Julie!’);
});
});
Advantages over Selenium
JavaScript automation frameworks involve working on asynchronous execution, callbacks,
anonymous functions and promise, which is a sequential activity just like finding an object
and perform operations on it. Another advantage of transitioning to Protractor/JavaScript is
that both the application and the test codebase would be written in the same language.
For Angular Apps
Protractor provides support for Angular-specific locator bindings, which allows you to test
Angular-specific web elements without any need for additional setup effort. It has extra
locators compared to selenium webdriver. Examples include model, repeater, binding etc.
Angular JS applications have some extra HTML attributes like ng-repeater, ng-controller, ng-
model which are not included in Selenium locators. Selenium is not able to identify those
web elements using today used Selenium code. Protractor on top of Selenium can
handMoving from Selenium to Protractor for Test Automationle and control these operations
in Web Applications.
Example –
element(by.model(‘locator’)).sendKeys(‘text’);
element(by.binding(‘locator’)).click();
Automatic Waiting
When it comes to waiting for elements on a web page, there is no need to add waits and
sleeps to your test. Protractor automatically executes the next step in your test the moment a
webpage finishes all pending tasks. There is no need to worry about waiting for your test and
webpage to sync in. Protractor, moreover, also speeds up your testing as it avoids the
requirement for a lot of “sleeps” and “waits” in your tests, which in turn optimizes sleep and
wait times.
Supports Extensibility
Since protractor is a node.js application, can utilize the wide variety of packages that are
available in the node. One can extend the framework or add additional features by installing
node packages. For example, if you need HTML report you can just use Jasmine HTML
Reporter for the clean code you can install eslint or tslint. Likewise, you can install node
packages of your choice.
Supports Control Flow
Application Programming Interface (API) is based on promises, which are managed by
control flows and adapted for Jasmine. Protractor APIs are purely asynchronous. It maintains
a queue of pending promises, called the control flow, to keep execution organized.
Jasmine
System Architecture
Asynchronous Behavior
Works on NodeJS, so that the asynchronous process helps to speeding up the execution.
Here is how you it is achieved.
1) Promise Manager/ Control Flow
It is an abstraction that makes every action to be called one by one, like a queue. Every action
returns a special object – Promise. These represent the result of async operation.
2) Second way – async/await
It is new abstraction around promises objects and allows easily chaining actions one by one.
The advantage in this is native language construction, instead of Promise Manager, which
makes your code look like synchronized, with try/catch and other familiar constructions.
describe(‘angularjs homepage’, function() {
it(‘should greet the named user’, async function() {
await browser.get(‘http://www.angularjs.org’);
await element(by.model(‘yourName’)).sendKeys(‘Julie’);
var greeting = element(by.binding(‘yourName’));
expect(await greeting.getText()).toEqual(‘Hello Julie!’);
});
“await” is like “suspend code execution until a promise returned from the action is resolved”.
Images and Screenshots
Image comparison is very easy in protractor and it works great. Protractor helps you take
screenshots on demand and create them in any place needed. You just need to specify the
type of Reporter that you want to use.
Example –
jasmine.getEnv().addReporter(new HtmlReporter(){
this.specDone = function(result){
if(result.failedExpectations.length > 0){
//take Screenshot
}
}
}
Conclusion/ Summary
There is a big world of Protractor out there and there are hundreds of packages available in
the market offered by NPM to add more features to your test in addition to simple test
scenarios.

More Related Content

What's hot

Introduction to AngularJS Framework
Introduction to AngularJS FrameworkIntroduction to AngularJS Framework
Introduction to AngularJS FrameworkRaveendra R
 
The productive developer guide to Angular 2
The productive developer guide to Angular 2The productive developer guide to Angular 2
The productive developer guide to Angular 2Maurice De Beijer [MVP]
 
Introduction to Angular js 2.0
Introduction to Angular js 2.0Introduction to Angular js 2.0
Introduction to Angular js 2.0Nagaraju Sangam
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core ConceptsFabio Biondi
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation Phan Tuan
 
AngularJS Beginners Workshop
AngularJS Beginners WorkshopAngularJS Beginners Workshop
AngularJS Beginners WorkshopSathish VJ
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS introdizabl
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSGettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSArmin Vieweg
 
AngularJS 2.0 Jumpstart
AngularJS 2.0 JumpstartAngularJS 2.0 Jumpstart
AngularJS 2.0 JumpstartFilipe Falcão
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)Gary Arora
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2Knoldus Inc.
 
Angular2 with type script
Angular2 with type scriptAngular2 with type script
Angular2 with type scriptRavi Mone
 
AngularJS: Overview & Key Features
AngularJS: Overview & Key FeaturesAngularJS: Overview & Key Features
AngularJS: Overview & Key FeaturesMohamad Al Asmar
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overviewJesse Warden
 
Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Nir Kaufman
 
AngularJS: Service, factory & provider
AngularJS: Service, factory & providerAngularJS: Service, factory & provider
AngularJS: Service, factory & providerCorley S.r.l.
 

What's hot (20)

Introduction to AngularJS Framework
Introduction to AngularJS FrameworkIntroduction to AngularJS Framework
Introduction to AngularJS Framework
 
The productive developer guide to Angular 2
The productive developer guide to Angular 2The productive developer guide to Angular 2
The productive developer guide to Angular 2
 
Introduction to Angular js 2.0
Introduction to Angular js 2.0Introduction to Angular js 2.0
Introduction to Angular js 2.0
 
Angular 2 - Core Concepts
Angular 2 - Core ConceptsAngular 2 - Core Concepts
Angular 2 - Core Concepts
 
AngularJS
AngularJSAngularJS
AngularJS
 
AngularJs presentation
AngularJs presentation AngularJs presentation
AngularJs presentation
 
AngularJS Beginners Workshop
AngularJS Beginners WorkshopAngularJS Beginners Workshop
AngularJS Beginners Workshop
 
AngularJS intro
AngularJS introAngularJS intro
AngularJS intro
 
Gettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJSGettings started with the superheroic JavaScript library AngularJS
Gettings started with the superheroic JavaScript library AngularJS
 
AngularJS 2.0 Jumpstart
AngularJS 2.0 JumpstartAngularJS 2.0 Jumpstart
AngularJS 2.0 Jumpstart
 
Angular2 intro
Angular2 introAngular2 intro
Angular2 intro
 
AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)AngularJS - What is it & Why is it awesome ? (with demos)
AngularJS - What is it & Why is it awesome ? (with demos)
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Angular2 with type script
Angular2 with type scriptAngular2 with type script
Angular2 with type script
 
AngularJS: Overview & Key Features
AngularJS: Overview & Key FeaturesAngularJS: Overview & Key Features
AngularJS: Overview & Key Features
 
Angular 2 overview
Angular 2 overviewAngular 2 overview
Angular 2 overview
 
Angularjs - lazy loading techniques
Angularjs - lazy loading techniques Angularjs - lazy loading techniques
Angularjs - lazy loading techniques
 
AngularJS: Service, factory & provider
AngularJS: Service, factory & providerAngularJS: Service, factory & provider
AngularJS: Service, factory & provider
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
 
5 angularjs features
5 angularjs features5 angularjs features
5 angularjs features
 

Similar to Moving from selenium to protractor for test automation

Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01Arunangsu Sahu
 
Effective testing of rich internet applications
Effective testing of rich internet applicationsEffective testing of rich internet applications
Effective testing of rich internet applicationsRashwin
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to AngularjsGaurav Agrawal
 
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 with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsAutomation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsQuontra Solutions
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriverAnuraj S.L
 
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdfanoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdfSunilNagaraj10
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with exampleshadabgilani
 
Angular 6 Training with project in hyderabad india
Angular 6 Training with project in hyderabad indiaAngular 6 Training with project in hyderabad india
Angular 6 Training with project in hyderabad indiaphp2ranjan
 
Case study: Open Source Automation Framework using Selenium WebDriver
Case study: Open Source Automation Framework using Selenium WebDriverCase study: Open Source Automation Framework using Selenium WebDriver
Case study: Open Source Automation Framework using Selenium WebDriverRTTS
 
An introduction to AngularJS
An introduction to AngularJSAn introduction to AngularJS
An introduction to AngularJSYogesh singh
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.jsMek Srunyu Stittri
 

Similar to Moving from selenium to protractor for test automation (20)

Protractor overview
Protractor overviewProtractor overview
Protractor overview
 
Angular js
Angular jsAngular js
Angular js
 
AngularJs
AngularJsAngularJs
AngularJs
 
Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01Angularjs 131211063348-phpapp01
Angularjs 131211063348-phpapp01
 
AngularJS in practice
AngularJS in practiceAngularJS in practice
AngularJS in practice
 
Effective testing of rich internet applications
Effective testing of rich internet applicationsEffective testing of rich internet applications
Effective testing of rich internet applications
 
Intoduction to Angularjs
Intoduction to AngularjsIntoduction to Angularjs
Intoduction to Angularjs
 
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
 
Mean stack Magics
Mean stack MagicsMean stack Magics
Mean stack Magics
 
Automation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsAutomation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra Solutions
 
AngularJS - A JavaScript Framework
AngularJS - A JavaScript FrameworkAngularJS - A JavaScript Framework
AngularJS - A JavaScript Framework
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
 
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdfanoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
Training On Angular Js
Training On Angular JsTraining On Angular Js
Training On Angular Js
 
Angular 6 Training with project in hyderabad india
Angular 6 Training with project in hyderabad indiaAngular 6 Training with project in hyderabad india
Angular 6 Training with project in hyderabad india
 
Case study: Open Source Automation Framework using Selenium WebDriver
Case study: Open Source Automation Framework using Selenium WebDriverCase study: Open Source Automation Framework using Selenium WebDriver
Case study: Open Source Automation Framework using Selenium WebDriver
 
Angular In Depth
Angular In DepthAngular In Depth
Angular In Depth
 
An introduction to AngularJS
An introduction to AngularJSAn introduction to AngularJS
An introduction to AngularJS
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 

More from Zoe Gilbert

SAP HANA Implementation A Complete Guide.pdf
SAP HANA Implementation A Complete Guide.pdfSAP HANA Implementation A Complete Guide.pdf
SAP HANA Implementation A Complete Guide.pdfZoe Gilbert
 
HIPAA Compliance Testing In Software Applications.pdf
HIPAA Compliance Testing In Software Applications.pdfHIPAA Compliance Testing In Software Applications.pdf
HIPAA Compliance Testing In Software Applications.pdfZoe Gilbert
 
Checklist For Modernizing Your Legacy Application.pdf
Checklist For Modernizing Your Legacy Application.pdfChecklist For Modernizing Your Legacy Application.pdf
Checklist For Modernizing Your Legacy Application.pdfZoe Gilbert
 
Ad Hoc Testing: Everything You Need To Know
      Ad Hoc Testing: Everything You Need To Know       Ad Hoc Testing: Everything You Need To Know
Ad Hoc Testing: Everything You Need To Know Zoe Gilbert
 
Eliminate OTT Platform Flaws with Quality Engineering.pdf
Eliminate OTT Platform Flaws with Quality Engineering.pdfEliminate OTT Platform Flaws with Quality Engineering.pdf
Eliminate OTT Platform Flaws with Quality Engineering.pdfZoe Gilbert
 
Best Tools for Website Accessibility Testing in 2022.pdf
Best Tools for Website Accessibility Testing in 2022.pdfBest Tools for Website Accessibility Testing in 2022.pdf
Best Tools for Website Accessibility Testing in 2022.pdfZoe Gilbert
 
What are the Advantages and Disadvantages of Microservices?
What are the Advantages and Disadvantages of Microservices? What are the Advantages and Disadvantages of Microservices?
What are the Advantages and Disadvantages of Microservices? Zoe Gilbert
 
Embedded Testing Vs Software Testing – Key Difference.pdf
Embedded Testing Vs Software Testing – Key Difference.pdfEmbedded Testing Vs Software Testing – Key Difference.pdf
Embedded Testing Vs Software Testing – Key Difference.pdfZoe Gilbert
 
Why is Low Code Automation Testing Gaining Popular.pdf
Why is Low Code Automation Testing Gaining Popular.pdfWhy is Low Code Automation Testing Gaining Popular.pdf
Why is Low Code Automation Testing Gaining Popular.pdfZoe Gilbert
 
Logistics Automation to Strengthen Process Efficiency.pdf
Logistics Automation to Strengthen Process Efficiency.pdfLogistics Automation to Strengthen Process Efficiency.pdf
Logistics Automation to Strengthen Process Efficiency.pdfZoe Gilbert
 
Accelerating Digital Transformation in the BFSI Sector.pdf
Accelerating Digital Transformation in the BFSI Sector.pdfAccelerating Digital Transformation in the BFSI Sector.pdf
Accelerating Digital Transformation in the BFSI Sector.pdfZoe Gilbert
 
Hyperautomation.pdf
Hyperautomation.pdfHyperautomation.pdf
Hyperautomation.pdfZoe Gilbert
 
What is the Right Approach to QA Outsourcing.pdf
What is the Right Approach to QA Outsourcing.pdfWhat is the Right Approach to QA Outsourcing.pdf
What is the Right Approach to QA Outsourcing.pdfZoe Gilbert
 
AI in Cloud Computing
AI in Cloud ComputingAI in Cloud Computing
AI in Cloud ComputingZoe Gilbert
 
Boast the Potential of DevOps with CI CD
Boast the Potential of DevOps with CI CDBoast the Potential of DevOps with CI CD
Boast the Potential of DevOps with CI CDZoe Gilbert
 
What is Sanity Testing.pdf
What is Sanity Testing.pdfWhat is Sanity Testing.pdf
What is Sanity Testing.pdfZoe Gilbert
 
Tackle Business Risks with Continuous Testing.pdf
Tackle Business Risks with Continuous Testing.pdfTackle Business Risks with Continuous Testing.pdf
Tackle Business Risks with Continuous Testing.pdfZoe Gilbert
 
Guide to Successful AI.pdf
Guide to Successful AI.pdfGuide to Successful AI.pdf
Guide to Successful AI.pdfZoe Gilbert
 
Top Software Testing Models for Customer Satisfaction.pdf
Top Software Testing Models for Customer Satisfaction.pdfTop Software Testing Models for Customer Satisfaction.pdf
Top Software Testing Models for Customer Satisfaction.pdfZoe Gilbert
 
Compliance testing or conformance testing
Compliance testing or conformance testingCompliance testing or conformance testing
Compliance testing or conformance testingZoe Gilbert
 

More from Zoe Gilbert (20)

SAP HANA Implementation A Complete Guide.pdf
SAP HANA Implementation A Complete Guide.pdfSAP HANA Implementation A Complete Guide.pdf
SAP HANA Implementation A Complete Guide.pdf
 
HIPAA Compliance Testing In Software Applications.pdf
HIPAA Compliance Testing In Software Applications.pdfHIPAA Compliance Testing In Software Applications.pdf
HIPAA Compliance Testing In Software Applications.pdf
 
Checklist For Modernizing Your Legacy Application.pdf
Checklist For Modernizing Your Legacy Application.pdfChecklist For Modernizing Your Legacy Application.pdf
Checklist For Modernizing Your Legacy Application.pdf
 
Ad Hoc Testing: Everything You Need To Know
      Ad Hoc Testing: Everything You Need To Know       Ad Hoc Testing: Everything You Need To Know
Ad Hoc Testing: Everything You Need To Know
 
Eliminate OTT Platform Flaws with Quality Engineering.pdf
Eliminate OTT Platform Flaws with Quality Engineering.pdfEliminate OTT Platform Flaws with Quality Engineering.pdf
Eliminate OTT Platform Flaws with Quality Engineering.pdf
 
Best Tools for Website Accessibility Testing in 2022.pdf
Best Tools for Website Accessibility Testing in 2022.pdfBest Tools for Website Accessibility Testing in 2022.pdf
Best Tools for Website Accessibility Testing in 2022.pdf
 
What are the Advantages and Disadvantages of Microservices?
What are the Advantages and Disadvantages of Microservices? What are the Advantages and Disadvantages of Microservices?
What are the Advantages and Disadvantages of Microservices?
 
Embedded Testing Vs Software Testing – Key Difference.pdf
Embedded Testing Vs Software Testing – Key Difference.pdfEmbedded Testing Vs Software Testing – Key Difference.pdf
Embedded Testing Vs Software Testing – Key Difference.pdf
 
Why is Low Code Automation Testing Gaining Popular.pdf
Why is Low Code Automation Testing Gaining Popular.pdfWhy is Low Code Automation Testing Gaining Popular.pdf
Why is Low Code Automation Testing Gaining Popular.pdf
 
Logistics Automation to Strengthen Process Efficiency.pdf
Logistics Automation to Strengthen Process Efficiency.pdfLogistics Automation to Strengthen Process Efficiency.pdf
Logistics Automation to Strengthen Process Efficiency.pdf
 
Accelerating Digital Transformation in the BFSI Sector.pdf
Accelerating Digital Transformation in the BFSI Sector.pdfAccelerating Digital Transformation in the BFSI Sector.pdf
Accelerating Digital Transformation in the BFSI Sector.pdf
 
Hyperautomation.pdf
Hyperautomation.pdfHyperautomation.pdf
Hyperautomation.pdf
 
What is the Right Approach to QA Outsourcing.pdf
What is the Right Approach to QA Outsourcing.pdfWhat is the Right Approach to QA Outsourcing.pdf
What is the Right Approach to QA Outsourcing.pdf
 
AI in Cloud Computing
AI in Cloud ComputingAI in Cloud Computing
AI in Cloud Computing
 
Boast the Potential of DevOps with CI CD
Boast the Potential of DevOps with CI CDBoast the Potential of DevOps with CI CD
Boast the Potential of DevOps with CI CD
 
What is Sanity Testing.pdf
What is Sanity Testing.pdfWhat is Sanity Testing.pdf
What is Sanity Testing.pdf
 
Tackle Business Risks with Continuous Testing.pdf
Tackle Business Risks with Continuous Testing.pdfTackle Business Risks with Continuous Testing.pdf
Tackle Business Risks with Continuous Testing.pdf
 
Guide to Successful AI.pdf
Guide to Successful AI.pdfGuide to Successful AI.pdf
Guide to Successful AI.pdf
 
Top Software Testing Models for Customer Satisfaction.pdf
Top Software Testing Models for Customer Satisfaction.pdfTop Software Testing Models for Customer Satisfaction.pdf
Top Software Testing Models for Customer Satisfaction.pdf
 
Compliance testing or conformance testing
Compliance testing or conformance testingCompliance testing or conformance testing
Compliance testing or conformance testing
 

Recently uploaded

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 

Recently uploaded (20)

Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 

Moving from selenium to protractor for test automation

  • 1. Moving from Selenium to Protractor for Test Automation Protractor is an end-to-end Testing Framework for testing Angular as well as AngularJS applications. It helps you runs tests against your application running in a real browser, interacting in exactly the same way a user would. The first version of Protractor was released in the month of July 2013, when the framework was just a prototype of a particular testing framework. Google, however, with the support of the testing community, is evolving the framework to follow the evolution of AngularJS and to meet the needs of the community that is using AngularJS. Why use Protractor over Selenium? Test Your Application like a User Protractor framework is built on top of WebDriverJS, which uses native events and browser- specific drivers to interact with your application exactly like a user would. It is based on Behaviour Driven approach which allows even a non automation tester to test the application without expertise in automation tool. Example – describe(‘angularjs homepage’, function() { it(‘should greet the named user’, function() { // Load the AngularJS homepage. browser.get(‘http://www.angularjs.org’); element(by.model(‘yourName’)).sendKeys(‘Julie’); var greeting = element(by.binding(‘yourName’)); // Used to assert that the text element has the required expected value. // Protractor patches ‘expect’ to understand promises.
  • 2. expect(greeting.getText()).toEqual(‘Hello Julie!’); }); }); Advantages over Selenium JavaScript automation frameworks involve working on asynchronous execution, callbacks, anonymous functions and promise, which is a sequential activity just like finding an object and perform operations on it. Another advantage of transitioning to Protractor/JavaScript is that both the application and the test codebase would be written in the same language. For Angular Apps Protractor provides support for Angular-specific locator bindings, which allows you to test Angular-specific web elements without any need for additional setup effort. It has extra locators compared to selenium webdriver. Examples include model, repeater, binding etc. Angular JS applications have some extra HTML attributes like ng-repeater, ng-controller, ng- model which are not included in Selenium locators. Selenium is not able to identify those web elements using today used Selenium code. Protractor on top of Selenium can handMoving from Selenium to Protractor for Test Automationle and control these operations in Web Applications. Example – element(by.model(‘locator’)).sendKeys(‘text’); element(by.binding(‘locator’)).click(); Automatic Waiting When it comes to waiting for elements on a web page, there is no need to add waits and sleeps to your test. Protractor automatically executes the next step in your test the moment a webpage finishes all pending tasks. There is no need to worry about waiting for your test and webpage to sync in. Protractor, moreover, also speeds up your testing as it avoids the requirement for a lot of “sleeps” and “waits” in your tests, which in turn optimizes sleep and wait times. Supports Extensibility Since protractor is a node.js application, can utilize the wide variety of packages that are available in the node. One can extend the framework or add additional features by installing node packages. For example, if you need HTML report you can just use Jasmine HTML Reporter for the clean code you can install eslint or tslint. Likewise, you can install node packages of your choice. Supports Control Flow Application Programming Interface (API) is based on promises, which are managed by control flows and adapted for Jasmine. Protractor APIs are purely asynchronous. It maintains a queue of pending promises, called the control flow, to keep execution organized.
  • 3. Jasmine System Architecture Asynchronous Behavior Works on NodeJS, so that the asynchronous process helps to speeding up the execution. Here is how you it is achieved. 1) Promise Manager/ Control Flow It is an abstraction that makes every action to be called one by one, like a queue. Every action returns a special object – Promise. These represent the result of async operation. 2) Second way – async/await
  • 4. It is new abstraction around promises objects and allows easily chaining actions one by one. The advantage in this is native language construction, instead of Promise Manager, which makes your code look like synchronized, with try/catch and other familiar constructions. describe(‘angularjs homepage’, function() { it(‘should greet the named user’, async function() { await browser.get(‘http://www.angularjs.org’); await element(by.model(‘yourName’)).sendKeys(‘Julie’); var greeting = element(by.binding(‘yourName’)); expect(await greeting.getText()).toEqual(‘Hello Julie!’); }); “await” is like “suspend code execution until a promise returned from the action is resolved”. Images and Screenshots Image comparison is very easy in protractor and it works great. Protractor helps you take screenshots on demand and create them in any place needed. You just need to specify the type of Reporter that you want to use. Example – jasmine.getEnv().addReporter(new HtmlReporter(){ this.specDone = function(result){ if(result.failedExpectations.length > 0){ //take Screenshot } } } Conclusion/ Summary There is a big world of Protractor out there and there are hundreds of packages available in the market offered by NPM to add more features to your test in addition to simple test scenarios.