Protractor Interview Questions
- 1) What is Protractor?
- 2) Enlist few features of Protractor?
- 3) How to install Protractor on windows?
- 4) How to cancel and accept Alert in Protractor?
- 5) What is use browser.refresh in Protractor?
- 6) Enlist few locators available in Protractor?
- 7) How to getText on an input in protractor?
- 8) How to use Cucumber with Protractor?
- 9) Protractor is built on top of What?
- 11) How to select an option from dropdown in Protractor e2e testing?
- 12) How to set default browser window size in Protractor/WebdriverJS?
- 13) How to locate elements that have a specific class name.in Protractor?
- 14) How to create promises in Protractor?
- 15) How to install Protractor for?
- 16) How can I get the current URL using a protractor?
- 17) What is browser.ignoreSynchronization in protractor?
- 18) List the different mouse actions that can be performed using protractor?
- 19) List the major differences between Protractor vs Selenium?
- 20) What is Yeoman?
- 21) What is Grunt?
- 22) What is Jasmine?
- 23) What is Mocha?
- 24) List Behavior-driven development (BDD) test frameworks supported By Protractor?
- 25) What is SPA Application?
Below are the list of Best Protractor Interview Questions and Answers
Protractor is an end to end testing framework for AngularJs Applications. It is built on top of WebDriverJs protocol which internally uses native events and browser-specific drivers to interact with our application.
- It uses the simple syntax for writing test cases.
- Have angular-specific locators like ng-model, ng-bind, etc.
- Supports behavior-driven development tools like Jasmine/Mocha
- Easily integrated with Jenkins/Browser, Stack/Grunt.
- Support all latest browsers like Firefox, Chrome, Safari, Internet explorer.
You can use the following commands to install Protractor on windows:
Use npm to install Protractor globally with: npm install -g protractor
You can cancel Alert in Protractor by using dismiss() as follows:
The dismiss() method is used to cancel the alert for handling alerts in Selenium. It is functional for all alert types: prompt, alert, and confirmation dialogue box.
driver.switchTo().alert().dismiss(); It activates by clicking on the “X” button in the prompt.
You can accept Alert in Protractor by using accept() as follows:
var myAlert = browser.switchTo().alert(); myAlert.accept(); Click on the 'OK' button will confirm the action
browser.refresh() is used to refresh the current page or making a full reload of the current page in Protractor. It assumes that the current application is an angular application and waits to load before executing the next command.
Few locators available in Protractor are as follows:
To get a text on an input in the protractor you can use getText() function.
To use Cucumber. js, you should update the framework and add a framework path, and then add a few cucumberOpts that specify where to find the step definition files such that it will now run the protractor cucumber.
Protractor is built on top of WebDriverJS. It includes important improvements for AngularJS apps.
You can select an option from the dropdown in Protractor e2e testing with the following step:
- Find the dropdown using the element.
- Click the dropdown.
- Click the option.
You can use the following code to set the default window size in Protractor/WebdriverJs:
browser.executeScript('window.moveTo(0,0);' + 'window.resizeTo(screen.width, screen.height);');
webdriver.By.className is used in Protractor to locates elements that have a specific class name.
With the help of following syntax you can create a promise in protractor, the code snippet is:
var deferred = protractor.promise.defer();
var promise = deferred.promise;
Use npm to install Protractor globally with npm install -g protractor. This will install two command-line tools, protractor and webdriver-manager. By running protractor --version you can insure it's working.
You can get the current URL using protractor by using browser.getCurrentUrl() as follows:
browser. ignoreSynchronization is the driver method used directly to find the elements such that the system will try to find them without waiting for any ongoing $http requests to finish, It can be done by setting browser. ignoreSynchronization = true .
Mouse actions are the demonstration of mouse activities (such as hover, clicking, drag, and drop) that can be easily simulated in Selenium Protractor with the predefined methods for mouse movement, clicking, and others.
Different mouse actions that can be performed using protractor are as follows:
- dragAndDrop( source , target )
- dragAndDropBy(source, xOffset, yOffset)
- moveByOffset(xOffset, yOffset)
Major differences between Protractor and Selenium are as follows:
|You can automate the web applications using the selenium WebDriver with Java or any programming language of choice.||Prefer Protractor when you are not comfortable with handling the ajax and angular waits using fluent wait in Selenium.|
|Supports many frameworks of unit testing, such as TestNg and Junit.||Protractor works well with Jasmine and Mocha frameworks.|
|You need a lesser number of code lines for testing with Selenium.||Code length is longer when you use Protractor because all of the fetch operation return promises, so you have to solve the promises first.|
|Selenium’s performance is faster for a non-Angular web application.||When working with Angular applications, the protractor offers faster performance.|
|It is open-source software.||It is also open-source software.|
|Enough options for locators.||Lesser option for locators.|
|Debugging is easy owing to Java-based design.||Debugging needs expertise and time-consuming.|
|Licensed under Eclipse.||Licensed under Webstorm7.0.|
|The framework is proven and widely used.||The framework is budding and harder comparatively.|
|Compatible with Windows and Linux.||This is also compatible with Windows and Linux.|
|Works well with Angular pages too; however, page synchronization issues may crop up.||Designed specifically for Angular pages and works with non-angular too without any issues.|
|Proven, widely used for automation, well-extended support, and stable API.||New entrée in the market and needs the expertise to work with.|
|Offers comprehensive support for all sorts of testing needs for web applications.||This is just a wrapper developed over WebDriver JS. No new verticals for browser automation are developed as such.|
|Cannot trace and work with angular directives in a code.||Rich in angular specific locator strategy and can work comfortably with locators.|
Yeoman is a scaffolding system that allows you to rapidly create any kind of application. It gets you to start on the new projects and streamline the maintenance of the existing projects. You can create a project with yeoman in any language.
Yeoman is also used to bootstrap new services, create modules or packaged, promote new projects, and enforce standards & best practices.
Protractor support Jasmine and Mocha BDD test frameworks.
A SPA application is a web app load a single HTML page and dynamically update that page as the user interacts with the app.SPA using ajax and HTML5 to create fluid and responsive Web apps, without constant page reloads.
Online Training Programs
Latest Interview Questions
Illegal Interview Questions
AngularJS Basic Interview Questions
QuickBooks Interview Questions
Puppet Interview Questions
Public Relations Interview Questions
PouchDB Interview Questions
PolymerJs Interview Questions
PHP String Interview Questions
PHP 7 Interview Questions
Phantomjs Interview Questions
Perl Interview Questions
jQuery Mobile Interview Questions
Aws Interview Questions
Aurelia Interview Questions
Oscommerce interview questions
PHPixie framework interview questions
OrientDB Interview Questions
Java Testing Interview Questions
Pascal Interview Questions
Sap Netweaver Interview Questions
PHP Nette Framework Interview Questions
Scala Interview Questions
TYPO3 Interview Questions
Silex Framework Interview Questions
Marionette js Interview Questions
Phalcon Interview Questions
SilverStripe interview questions
Sinatra Framework Interview Questions
PowerShell Interview Questions
SQL Server Interview Questions
Subscribe Our NewsLetter
Never Miss an Articles from us.