Top Protractor Interview Questions (2024) | CodeUsingJava
















Most frequently asked Protractor Interview Questions


  1. What is the meaning of Protractor?
  2. Name some of the Locators in Protractor?
  3. What are various API used in Protractor?
  4. How to install Protractor on windows?
  5. What are the advantages of using Protractor?
  6. What is a conf file in Protractor?
  7. How you use Protractor for testing Non-Angular JS applications?
  8. What are Jasmine and Mocha?
  9. What are different mouses actions that can be performed using protractor?
  10. Can we use protractor with typescript?
  11. What are the types of failure in Protractor?
  12. How to get text from a textbox in Protractor?


What is the meaning of Protractor?

Protractor is build by Google on top of WebDriver as it helps in working as a solution integrator which combines powerful technologies like NodeJS, Selenium, Jasmine, WebDriver, etc. It is an end to end framework for angular and angular JS applications, it is also the Java script implementation of Selenium framework. Protractor helps in writing automated regression tests for normal web application.

ESB


Name some of the Locators in Protractor?

By Model
By Button Text
By Exact Binding
By Partial Button Text
By Repeater
By Exact Repeater
By CSS Containing Text
By Options
By deep Css


What are various API used in Protractor?

  • Browser - Used in handling browser level commands.
  • Element - Helps in interacting with DOM element on the page.
  • Locator - Used in collecting locator stratergies.

How to install Protractor on windows?

We can use the following commands on windows:
We can use npm for installing protractor globally by using:
npm install -g protractor

What are the advantages of using Protractor?

Excellent test speed
Supports TDD
Offers Selenium WebDriver
Easy to install and setup
Supports multiple browsers
Provides auto-synchronization


What is a conf file in Protractor?

The conf file helps us to trigger for the protractor package execution.it tells the protractor in setting up the browsers, and which test framework to use.
The conf file helps us by providing explanations for all protractor conf options.It also include one or more global settings.

How you use Protractor for testing Non-Angular JS applications?

We can use for testing non Angular JS application:
Protractor need jasmine. javascripts, selenium and node, js server.
Using Protractor for non-Angular JS applications should be followed by:
Using browser.driver in place of driver
Using browser.driver.ignoreSynchronization=true


What are Jasmine and Mocha?

Jasmine acts as a test framework like Java and Python.It is a default framework working with protractor.
It supports BDD styled tests.
Mocha acts like a test runner.


What are different mouses actions that can be performed using protractor?

mouseMove()
dragAndDrop
click()
doubleClick()
mouseUp()
mouseDown()
contextClick()
clickAndHold()
dragAndDropBy
moveByOffset(xOffset, yOffset)
moveToElement(toElement)
release()
mouseMove()
mouseHover()


Can we use protractor with typescript?

Yes, we can use typescript with Protractor.
TypeScript is a set of JavaScript compiled to JavaScript.It is compiled developed and maintained by Microsoft and used to develop JavaScript applications for both client-side and server-side (Node.js) execution.

What are the types of failure in Protractor?

  • WebDriver unexpected failure
  • WebDriver failure
  • Protractor Angular2 failure
  • Protractor failure for Angular
  • Expectation failure
  • Protractor failure for timeout

How to get text from a textbox in Protractor?

element(by.xpath("text box xpath").getAttribute("value")).then(function(textValue){
console.log(textValue)
});