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?
- 10) How to select an option from dropdown in Protractor e2e testing?
- 11) How to set default browser window size in Protractor/WebdriverJS?
- 12) How to test if an element has class or not in Protractor?
- 13) How to create and manipulate promises in Protractor?
- 14) How can I use command line arguments in Angularjs Protractor?
- 15) How can I get the current URL using a protractor?
- 16) What is browser.ignoreSynchronization in protractor?
- 17) List the different mouse actions that can be performed using protractor?
- 18) List the major differences between Protractor vs Selenium?
- 19) What is Yeoman?
- 20) What is Grunt?
- 21) What is Jasmine?
- 22) What is Mocha?
- 23) List Behavior-driven development (BDD) test frameworks supported By Protractor?
- 24) What is SPA Application?
- 25) How can we set value to prompt Alert in Protractor?
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
Few locators available in Protractor are as follows:
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);');
You can get the current URL using protractor by using browser.getCurrentUrl() as follows:
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.
Latest Interview Questions
IoT Interview Questions
PHP String Interview Questions
Cucumber Interview Questions
Apache Storm Interview Questions
Loadrunner Interview Questions
Splunk Interview Questions
Fedora Interview Questions
TestNG Interview Questions
Laravel Interview Questions
Swift Interview Questions
CSS interview questions
React Native Interview questions
Hibernate Interview Questions
MVC interview questions
C++ Interview Questions
Data Warehousing Interview Questions
Terraform Interview Questions
Elixir Interview Questions
XSD Interview Questions
UX Designer Interview Questions
Angularjs unit testing interview questions
Cordova Interview Questions
XHTML Interview Questions
XPath Interview Questions
Marionette js Interview Questions
Less.js Interview Questions
Handlebars js Interview Questions
Oracle Interview Questions
Sap lumira Interview Questions
SAP HANA Interview Questions
Subscribe Our NewsLetter
Never Miss an Articles from us.