SlideShare a Scribd company logo
Protractor Testing
Automation Tool Framework
Presented by Haitham Mahmoud
A Powerful JavaScript Framework
Introduction
Protractor plays an important role in the Testing of
AngularJS applications and works as a Solution
integrator combining powerful technologies like
Selenium
It is intended not only to test AngularJS application but
also for writing automated regression tests for normal
Web Applications as well.
What is AngularJS
AngularJS is a JavaScript-based open-source front-end
web application framework mainly maintained by
Google and by a community of individuals and
corporations to address many of the challenges
encountered in developing single-page applications.
Why Do We Need Protractor Framework?
JavaScript is used in almost all web applications. As the
applications grow, JavaScript also increases in size and
complexity. In such case, it becomes a difficult task for
Testers to test the web application for various scenarios.
Sometimes it is difficult to capture the web elements in
AngularJS applications using JUnit or Selenium WebDriver.
AngularJS application
AngularJS applications are Web Applications which uses
extended HTML's syntax to express web application
components. It is mainly used for dynamic web applications.
These applications use less and flexible code compared with
normal Web Applications.
Angular JS web elements using Normal
Selenium Web driver
Selenium is not able to identify those web elements using
Selenium code. So, Protractor on the top of Selenium can
handle and controls those attributes in Web Applications.
The protractor is an end to end testing framework
for Angular JS based applications. While most frameworks
focus on conducting unit tests for Angular JS applications,
Protractor focuses on testing the actual functionality of an
application.
Before we start Protractor
We need to install the following:
1. Selenium webdriver
2. NPM (Node.js)
How to install Node.js on Windows
2. NPM (Node.js)
1. NodeJS Installation, we need to install NodeJS to install Protractor.
1. Go to the site https://nodejs.org/en/download/ and download installer.
How to install Node.js on Windows
2. NPM (Node Package Manager) - (Node.js)
1. NodeJS Installation, we need to install NodeJS to install Protractor.
2. Double click on the downloaded .msi file to start the installation.
Click the Run button in the first screen
to begin the installation.
How to install Node.js on Windows
2. NPM (Node Package Manager) - (Node.js)
1. NodeJS Installation, we need to install NodeJS to install Protractor.
2. Double click on the downloaded .msi file to start the installation.
Click the Run button in the first screen
to begin the installation.
Running your first Hello world application
in Node.js
1. Create file Node.js with file name firstprogram.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('Hello World!');
}).listen(8080);
Executing the code
2. Save the file on your computer: C:UsersYour Name firstprogram.js
Output
3. Start your internet browser, and type in the address:
http://localhost:8080
Protractor Installation
1. Open command prompt and type "npm install –g protractor" and hit
Enter. Then type “Protractor --version”
Protractor Installation
2. Update the Web driver manager >> The CMD was opening
Now type “webdriver-manager update”
The web driver manager is used for running the tests against the angular
web application in a specific browser. After Protractor is installed, the web
driver manager needs to be updated to the latest version. This can be
done by running the following command in the command prompt.
Protractor Installation
2. Update the Web driver manager
Protractor Installation
3. Start the web driver manager >> The CMD was opening
Now type “webdriver-manager start”
This step will run the web driver manager in the background and will listen
to any tests which run via protractor.
Protractor Installation
4. Now, if you go to the following URL
(http://localhost:4444/wd/hub/static/resource/hub.html)
in your browser, you will actually see the Web driver manager running
in the background.
Let’s Go to test
Sample AngularJS application testing using
Protractor
Protractor needs two files to run, a spec file and configuration file.
1. Configuration file: This File helps protractor to where the test files
are placed (specs.js) and to talk with Selenium server (Selenium
Address). Chrome is the default browser for Protractor.
2. Spec file: This File contains the logic and locators to interact with
the application.
Let’s Go to test
Sample AngularJS application testing using
Protractor
1. We have to login https://angularjs.org
2. Enter the text as “Haitham“
3. Now we have to capture the text from the webpage after entering
the name and need to verify with the expected text.
Let’s Go to test
Sample AngularJS application testing using
Protractor
We have to prepare configuration file (conf.js) and spec file (spec.js) as
mentioned above.
Now we will create (spec.js)
describe('Enter Haitham Name', function() {
it('should add a Name as Haitham', function() {
browser.get('https://angularjs.org');
element(by.model('yourName')).sendKeys('Haitham');
var myName= element(by.xpath("//input[@class='ng-valid ng-dirty ng-valid-parse ng-touched ng-empty"]'));
expect(myName.getText()).toEqual('Hello Haitham!');
});
});
Let’s Go to test
Sample AngularJS application testing using
Protractor
We have to prepare configuration file (conf.js) and spec file (spec.js) as
mentioned above.
Now we will create (conf.js)
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['spec.js']
};
Let’s Go to test
Sample AngularJS application testing using
Protractor
• Execution of the Code
1. Open the command prompt.
2. Make sure selenium web driver manager is up and running. For that
give the command as "webdriver-manager start" and hit Enter.
3. Open a new command prompt and give the command as "protractor
conf.js" to run the configuration file.
Let’s Go to test
Sample AngularJS application testing using
Protractor
Let’s Go to test
Sample AngularJS application testing using
Protractor
Generate Reports using Jasmine
Reporters
Protractor supports Jasmine reporters to generate test reports. In this
section, we will use JunitXMLReporter to generate Test execution
reports automatically in XML format.
Installation of Jasmine Reporter
There are two way you can do this, locally or globally
1. Open command prompt execute the following command to install
locally
Above command will install jasmine reports node-modules locally
means from the directory where we are running the command in
command prompt.
npm install --save-dev jasmine-reporters@^2.0.0
Installation of Jasmine Reporter
Ignore this command
There are two way you can do this, locally or globally
2. Open command prompt execute the following command for global
installation
Above command will install jasmine reports node-modules locally
means from the directory where we are running the command in
command prompt.
npm install –g jasmine-reporters@^2.0.0
Install the jasmine reporters locally
1. Execute the command.
npm install --save-dev jasmine-reporters@^2.0.0
Installation of Jasmine Reporter
There are two way you can do this, locally or globally
1. Open command prompt execute the following command to install
locally
Install the jasmine reporters locally
2. Check the installation folders in the directory.
" Node_modules" should be available if it is successfully installed like in
below snapshot.
Install the jasmine reporters locally
3. Add the following colored code to an existed conf.js file
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
capabilities: {
'browserName': 'firefox'
},
specs: ['spec.js'],
framework: 'jasmine2' ,
onPrepare: function() {
var jasmineReporters = require('C:/Users/RE041943/Desktop/guru/node_modules/jasmine-
reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter(null, true, true)
);
}
};
Install the jasmine reporters locally
4. In code, we are generating the report "JUnitXmlReporter" and giving
the Path where to store the report.

More Related Content

What's hot (20)

PPTX
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
Simplilearn
 
PPTX
Automation - web testing with selenium
Tzirla Rozental
 
PDF
No drama here - E2E-testing django with playwright
Mastacheata1
 
PPT
Selenium Presentation at Engineering Colleges
Vijay Rangaiah
 
PDF
Webdriver io presentation
João Nabais
 
PPTX
Selenium-4
Manoj Kumar Kumar
 
PPTX
Selenium WebDriver training
Vijay Krishnan Ramaswamy
 
PPTX
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Edureka!
 
PDF
Webdriver.io
LinkMe Srl
 
PPTX
Selenium introduction
Deepak Kumar Digar
 
PDF
Webinar: Selenium WebDriver - Automation Uncomplicated
Edureka!
 
PDF
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
PDF
Introduction to Spring Boot
Trey Howard
 
PDF
Web application testing with Selenium
Kerry Buckley
 
PPTX
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
 
PPTX
Introduction to Selenium Web Driver
Return on Intelligence
 
PDF
Selenium Interview Questions and Answers For Freshers And Experienced | Edureka
Edureka!
 
PPTX
Step by step - Selenium 3 web-driver - From Scratch
Haitham Refaat
 
PPT
Test automation using selenium
shreyas JC
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
Simplilearn
 
Automation - web testing with selenium
Tzirla Rozental
 
No drama here - E2E-testing django with playwright
Mastacheata1
 
Selenium Presentation at Engineering Colleges
Vijay Rangaiah
 
Webdriver io presentation
João Nabais
 
Selenium-4
Manoj Kumar Kumar
 
Selenium WebDriver training
Vijay Krishnan Ramaswamy
 
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Edureka!
 
Webdriver.io
LinkMe Srl
 
Selenium introduction
Deepak Kumar Digar
 
Webinar: Selenium WebDriver - Automation Uncomplicated
Edureka!
 
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
Introduction to Spring Boot
Trey Howard
 
Web application testing with Selenium
Kerry Buckley
 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
 
Introduction to Selenium Web Driver
Return on Intelligence
 
Selenium Interview Questions and Answers For Freshers And Experienced | Edureka
Edureka!
 
Step by step - Selenium 3 web-driver - From Scratch
Haitham Refaat
 
Test automation using selenium
shreyas JC
 

Similar to Protractor Testing Automation Tool Framework / Jasmine Reporters (20)

PDF
AngularJS Project Setup step-by- step guide - RapidValue Solutions
RapidValue
 
PDF
Selenium for Tester.pdf
RTechRInfoIT
 
PDF
Front end workflow with yeoman
hassan hafez
 
PPTX
Django simplified : by weever mbakaya
Mbakaya Kwatukha
 
PDF
Android UI Testing with Appium
Luke Maung
 
PPTX
An Overview of Angular 4
Cynoteck Technology Solutions Private Limited
 
PDF
Getting started with appium
Pratik Patel
 
PPT
Testing Java Web Apps With Selenium
Marakana Inc.
 
PPTX
Selenium.pptx
Pandiya Rajan
 
PPT
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
chrisb206 chrisb206
 
PPTX
Protractor framework architecture with example
shadabgilani
 
PDF
Getting Started with Playwright: A Beginner-Friendly Introduction & Setup Guide
Shubham Joshi
 
PDF
Node JS - A brief overview on building real-time web applications
Expeed Software
 
PDF
Exploring Maven SVN GIT
People Strategists
 
PPTX
Using galen framework for automated cross browser layout testing
Sarah Elson
 
PPTX
Qa process
Aila Bogasieru
 
PPT
Steps to write Selenium
Rohit Thakur
 
PPTX
Qa process
Aila Bogasieru
 
PPTX
How to use Jmeter for performance testing
chiragppatel0111
 
AngularJS Project Setup step-by- step guide - RapidValue Solutions
RapidValue
 
Selenium for Tester.pdf
RTechRInfoIT
 
Front end workflow with yeoman
hassan hafez
 
Django simplified : by weever mbakaya
Mbakaya Kwatukha
 
Android UI Testing with Appium
Luke Maung
 
Getting started with appium
Pratik Patel
 
Testing Java Web Apps With Selenium
Marakana Inc.
 
Selenium.pptx
Pandiya Rajan
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
chrisb206 chrisb206
 
Protractor framework architecture with example
shadabgilani
 
Getting Started with Playwright: A Beginner-Friendly Introduction & Setup Guide
Shubham Joshi
 
Node JS - A brief overview on building real-time web applications
Expeed Software
 
Exploring Maven SVN GIT
People Strategists
 
Using galen framework for automated cross browser layout testing
Sarah Elson
 
Qa process
Aila Bogasieru
 
Steps to write Selenium
Rohit Thakur
 
Qa process
Aila Bogasieru
 
How to use Jmeter for performance testing
chiragppatel0111
 
Ad

Recently uploaded (20)

PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PPTX
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Ad

Protractor Testing Automation Tool Framework / Jasmine Reporters

  • 1. Protractor Testing Automation Tool Framework Presented by Haitham Mahmoud
  • 3. Introduction Protractor plays an important role in the Testing of AngularJS applications and works as a Solution integrator combining powerful technologies like Selenium It is intended not only to test AngularJS application but also for writing automated regression tests for normal Web Applications as well.
  • 4. What is AngularJS AngularJS is a JavaScript-based open-source front-end web application framework mainly maintained by Google and by a community of individuals and corporations to address many of the challenges encountered in developing single-page applications.
  • 5. Why Do We Need Protractor Framework? JavaScript is used in almost all web applications. As the applications grow, JavaScript also increases in size and complexity. In such case, it becomes a difficult task for Testers to test the web application for various scenarios. Sometimes it is difficult to capture the web elements in AngularJS applications using JUnit or Selenium WebDriver.
  • 6. AngularJS application AngularJS applications are Web Applications which uses extended HTML's syntax to express web application components. It is mainly used for dynamic web applications. These applications use less and flexible code compared with normal Web Applications.
  • 7. Angular JS web elements using Normal Selenium Web driver Selenium is not able to identify those web elements using Selenium code. So, Protractor on the top of Selenium can handle and controls those attributes in Web Applications. The protractor is an end to end testing framework for Angular JS based applications. While most frameworks focus on conducting unit tests for Angular JS applications, Protractor focuses on testing the actual functionality of an application.
  • 8. Before we start Protractor We need to install the following: 1. Selenium webdriver 2. NPM (Node.js)
  • 9. How to install Node.js on Windows 2. NPM (Node.js) 1. NodeJS Installation, we need to install NodeJS to install Protractor. 1. Go to the site https://nodejs.org/en/download/ and download installer.
  • 10. How to install Node.js on Windows 2. NPM (Node Package Manager) - (Node.js) 1. NodeJS Installation, we need to install NodeJS to install Protractor. 2. Double click on the downloaded .msi file to start the installation. Click the Run button in the first screen to begin the installation.
  • 11. How to install Node.js on Windows 2. NPM (Node Package Manager) - (Node.js) 1. NodeJS Installation, we need to install NodeJS to install Protractor. 2. Double click on the downloaded .msi file to start the installation. Click the Run button in the first screen to begin the installation.
  • 12. Running your first Hello world application in Node.js 1. Create file Node.js with file name firstprogram.js var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/html'}); res.end('Hello World!'); }).listen(8080);
  • 13. Executing the code 2. Save the file on your computer: C:UsersYour Name firstprogram.js
  • 14. Output 3. Start your internet browser, and type in the address: http://localhost:8080
  • 15. Protractor Installation 1. Open command prompt and type "npm install –g protractor" and hit Enter. Then type “Protractor --version”
  • 16. Protractor Installation 2. Update the Web driver manager >> The CMD was opening Now type “webdriver-manager update” The web driver manager is used for running the tests against the angular web application in a specific browser. After Protractor is installed, the web driver manager needs to be updated to the latest version. This can be done by running the following command in the command prompt.
  • 17. Protractor Installation 2. Update the Web driver manager
  • 18. Protractor Installation 3. Start the web driver manager >> The CMD was opening Now type “webdriver-manager start” This step will run the web driver manager in the background and will listen to any tests which run via protractor.
  • 19. Protractor Installation 4. Now, if you go to the following URL (http://localhost:4444/wd/hub/static/resource/hub.html) in your browser, you will actually see the Web driver manager running in the background.
  • 20. Let’s Go to test Sample AngularJS application testing using Protractor Protractor needs two files to run, a spec file and configuration file. 1. Configuration file: This File helps protractor to where the test files are placed (specs.js) and to talk with Selenium server (Selenium Address). Chrome is the default browser for Protractor. 2. Spec file: This File contains the logic and locators to interact with the application.
  • 21. Let’s Go to test Sample AngularJS application testing using Protractor 1. We have to login https://angularjs.org 2. Enter the text as “Haitham“ 3. Now we have to capture the text from the webpage after entering the name and need to verify with the expected text.
  • 22. Let’s Go to test Sample AngularJS application testing using Protractor We have to prepare configuration file (conf.js) and spec file (spec.js) as mentioned above. Now we will create (spec.js) describe('Enter Haitham Name', function() { it('should add a Name as Haitham', function() { browser.get('https://angularjs.org'); element(by.model('yourName')).sendKeys('Haitham'); var myName= element(by.xpath("//input[@class='ng-valid ng-dirty ng-valid-parse ng-touched ng-empty"]')); expect(myName.getText()).toEqual('Hello Haitham!'); }); });
  • 23. Let’s Go to test Sample AngularJS application testing using Protractor We have to prepare configuration file (conf.js) and spec file (spec.js) as mentioned above. Now we will create (conf.js) exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['spec.js'] };
  • 24. Let’s Go to test Sample AngularJS application testing using Protractor • Execution of the Code 1. Open the command prompt. 2. Make sure selenium web driver manager is up and running. For that give the command as "webdriver-manager start" and hit Enter. 3. Open a new command prompt and give the command as "protractor conf.js" to run the configuration file.
  • 25. Let’s Go to test Sample AngularJS application testing using Protractor
  • 26. Let’s Go to test Sample AngularJS application testing using Protractor
  • 27. Generate Reports using Jasmine Reporters Protractor supports Jasmine reporters to generate test reports. In this section, we will use JunitXMLReporter to generate Test execution reports automatically in XML format.
  • 28. Installation of Jasmine Reporter There are two way you can do this, locally or globally 1. Open command prompt execute the following command to install locally Above command will install jasmine reports node-modules locally means from the directory where we are running the command in command prompt. npm install --save-dev jasmine-reporters@^2.0.0
  • 29. Installation of Jasmine Reporter Ignore this command There are two way you can do this, locally or globally 2. Open command prompt execute the following command for global installation Above command will install jasmine reports node-modules locally means from the directory where we are running the command in command prompt. npm install –g jasmine-reporters@^2.0.0
  • 30. Install the jasmine reporters locally 1. Execute the command. npm install --save-dev jasmine-reporters@^2.0.0
  • 31. Installation of Jasmine Reporter There are two way you can do this, locally or globally 1. Open command prompt execute the following command to install locally
  • 32. Install the jasmine reporters locally 2. Check the installation folders in the directory. " Node_modules" should be available if it is successfully installed like in below snapshot.
  • 33. Install the jasmine reporters locally 3. Add the following colored code to an existed conf.js file exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'firefox' }, specs: ['spec.js'], framework: 'jasmine2' , onPrepare: function() { var jasmineReporters = require('C:/Users/RE041943/Desktop/guru/node_modules/jasmine- reporters'); jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter(null, true, true) ); } };
  • 34. Install the jasmine reporters locally 4. In code, we are generating the report "JUnitXmlReporter" and giving the Path where to store the report.

Editor's Notes

  • #13: Code Explanation: The basic functionality of the "require" function is that it reads a JavaScript file, executes the file, and then proceeds to return an object. Using this object, one can then use the various functionalities available in the module called by the require function. So in our case, since we want to use the functionality of http and we are using the require(http) command. In this 2nd line of code, we are creating a server application which is based on a simple function. This function is called, whenever a request is made to our server application. When a request is received, we are asking our function to return a "Hello World" response to the client. The writeHead function is used to send header data to the client and while the end function will close the connection to the client. We are then using the server.listen function to make our server application listen to client requests on port no 7000. You can specify any available port over here.
  • #23: describe('Enter Haitham Name', function()The describe syntax is from the Jasmine framework. Here "describe" ('Enter Haitham Name') typically defines components of an application, which can be a class or function etc. In the code suite called as "Enter Haitham ," it's just a string and not a code. it('should add a Name as Haitham ', function() browser.get('https://angularjs.org')As like in Selenium Webdriver browser.get will open a new browser instance with mentioned URL. element(by.model('yourName')).sendKeys(Haitham ')Here we are finding the web element using the Model name as "yourName," which is the value of "ng-model" on the web page. var myName = element(by.xpath(('//input[@class=“ng-valid ng-dirty ng-valid-parse ng-touched ng-empty”]'))Here we are finding the web element using XPath and store its value in a variable “myName". expect(guru.getText()).toEqual('Hello Haitham!')Finally we are verifying the text which we have got from the webpage (using gettext() ) with expected text .
  • #24: seleniumAddress: 'http://localhost:4444/wd/hub'The Configuration file tells Protractor the location of Selenium Address to talk with Selenium WebDriver. specs: ['spec.js']This line tells Protractor the location of test files spec.js
  • #25: seleniumAddress: 'http://localhost:4444/wd/hub'The Configuration file tells Protractor the location of Selenium Address to talk with Selenium WebDriver. specs: ['spec.js']This line tells Protractor the location of test files spec.js
  • #30: seleniumAddress: 'http://localhost:4444/wd/hub'The Configuration file tells Protractor the location of Selenium Address to talk with Selenium WebDriver. specs: ['spec.js']This line tells Protractor the location of test files spec.js