50+ Protractor Interview Questions

Ace your Protractor interview with these 50+ Protractor interview questions. Boost you confidence and land your dream job with this comprehensive guide.

  • General Interview QuestionsArrow
  • CI/CD Tools Interview QuestionsArrow
  • Testing Types Interview QuestionsArrow
  • Testing Framework Interview QuestionsArrow


Protractor is a tool developers use to create automated tests for their code. The Google Web Toolkit team developed it and used WebDriverJS, Selenium, Node.js, and Jasmine to make creating tests easier.

With the growing demand for high-end software on the web and mobile platforms, modern businesses are looking for new development and testing processes to deliver excellence. Frameworks like Protractor can help with this, as their compatibility with Selenium allows for end-to-end testing.

This comprehensive guide will delve into 50+ Protractor interview questions, covering everything from fundamental concepts to advanced techniques, equipping you with the knowledge to excel in your following interview. So, let's dive into the world of Protractor and prepare you to tackle any question that comes your way.

Download Protractor Interview Questions

Note : We have compiled all Protractor Interview Question for you in a template format. Feel free to comment on it. Check it out now!!

What is a protractor, and what is its purpose?

Protractor is a JavaScript framework that tests Angular or AngularJS applications in real browsers, just like a real user would. It's built on Selenium WebDriver JS and has Angular-specific locator strategies. However, it was originally designed to test only AngularJS applications and also helps you write automation tests for non-Angular JS applications.

The purpose of Protractor is to automate the testing process by enabling testers to write scripts in JavaScript that can interact with the application's user interface. The framework allows them to verify that the application's functionality meets requirements.

How do you install Protractor and set up its configuration file?

To set up Protractor, we need to follow the following steps:

  • Install Node.js.
  • Install Protractor.
  • Update WebDriver Manager to the latest version.

What is the difference between synchronous and asynchronous code in Protractor?

Synchronous code in Protractor executes sequentially and waits for each statement to complete before executing the next one. This type of code blocks other statements from running until it has completed its task.

On the other hand, asynchronous code in Protractor runs in parallel with other statements without waiting for the previous statement to complete before executing the next one. This type of code is also known as non-blocking because it does not block the execution of other statements while running

How do you select elements in Protractor?

In Protractor, you can select elements on a web page in several ways. The following are the most common methods:

  • You can use the element()and element.all() functions to select elements by their CSS selector.
  • You can select elements by their ID using the element() function.
  • You can use the element() function to select elements by their name.
  • The element() function allows you to select elements by their AngularJS model.
  • The element() function allows you to select elements by their AngularJS binding.
  • You can use the element() function to select elements by their button text.

What is the difference between getText() and getAttribute() in Protractor?

`getText()` and `getAttribute()` are two methods used to retrieve information about a selected element on a web page. While they both have similar names, there is one difference between them: the return value.

The `getText()` method returns the visible text of an element but not any attribute values. On the other hand, the `getAttribute()` method returns the value of a specified attribute of an element. This makes it easy to retrieve information about an element, such as its id, class, name, value, and so on.

What is a promise in Protractor, and how do you handle it?

In Protractor, a promise represents a value or event that may not have occurred yet. A promise can be created when performing an action that involves an asynchronous operation, such as clicking a button or waiting for an element to appear. You can then use this promise to handle the result of the operation, which can either be a success or a failure.

How do you handle non-angular websites in Protractor?

Although Protractor is explicitly designed for testing AngularJS applications, it can still be used to test non-Angular websites. However, you will need to disable some of its features and use alternative strategies.

The nice solution to this is to use an option called ‘mask,’ which allows us to ignore a locator or group of locators from our comparison. For this Playwright visual regression testing tutorial, let's continue to use the eCommerce website - the main area that stands out to me is the image carousel, which constantly rotates between different products.


Note : Ready to put your skills to the test? Run a test now and refer to our Protractor with Selenium documentation to navigate any challenges along the way!

What is the role of waitForAngularEnabled() in Protractor?

The waitForAngularEnabled() function is used to turn off the AngularJS switch in the Protractor framework. This function accepts a boolean as a parameter. If set to false, the Protractor will not wait for Angular HTTP and timeout tasks to complete. This command can be used inside a spec or configuration file.

How do you use browser actions in Protractor?

The `browser.actions()` method in Protractor can be used to chain multiple actions together and perform them as a single sequence. An instance of `ActionSequence` is returned by this method, which provides a way to chain multiple actions together and perform them as a single sequence.

What is a Protractor locator strategy, and what are the locator strategies available?

TA locator strategy identifies elements on a page so that they can be interacted with programmatically. Protractor is a popular test automation framework for AngularJS applications that provides several locator strategies to find elements on a web page, including by their id, name, and XPath.

What is the difference between by.css() and by.xpath() in Protractor?

Both the `by.css()` and `by.xpath()` locator strategies are available in Protractor to find elements on a web page. The main difference between these two strategies is that the former uses CSS selectors, while the latter uses XPath expressions.

To interact with dropdown menus in Protractor, use the `protractor.ExpectedConditions` class to wait for the dropdown element to become clickable and then use the `element` and `element.all` methods to interact with the dropdown options.

What is the role of browser.driver in Protractor?

The `browser.driver` is an instance of WebDriver, which is used to control a web browser through programmatic interfaces. It creates a new instance of a web browser and manages interactions with the browser during a Protractor test. The `browser.driver` is used to navigate to different URLs, interact with elements on the page, and retrieve information about the page.

How do you handle alerts and pop-ups in Protractor?

Using the built-in `ExpectedConditions` class and the `browser.switchTo()` method, you can easily handle alerts and pop-ups in Protractor.

Here is an example of how to handle an alert box in Protractor:

// Wait for the alert to appear
const EC = protractor.ExpectedConditions;
const alertBox = EC.alertIsPresent();
browser.wait(alertBox, 5000, 'Alert box not found');
// Switch to the alert box and get the text
const alert = browser.switchTo().alert();
const alertText = alert.getText();
// Accept the alert

In this example, the `ExpectedConditions` class is used to wait for an alert box to appear on the page. If an alert box doesn't appear within 5 seconds, then an error message will be displayed.

How do you perform mouse actions in Protractor?

The `browser.actions()` method allows you to create a sequence of actions to be performed in a specific order. This can make it easier for you to perform mouse actions in Protractor.

How do you handle synchronization issues in Protractor?

When a test script runs faster than the web page being tested, errors such as element not found or stale element reference can occur. To handle synchronization issues in Protractor, you can use techniques such as Implicit Waits, Explicit Waits, Expected Conditions, and Control Flow.

What is the role of the Jasmine framework in Protractor?

Jasmine is a popular behavior-driven development framework for JavaScript that enables developers to write and organize tests in a structured manner. Jasmine provides developers with a set of functions and methods that allow them to write tests, organize test suites, and specify expectations in a structured manner.

How do you handle debugging in Protractor?

There are several ways to debug Protractor tests. The following techniques can be used to troubleshoot your Protractor tests:

  • Use console.log() statements: You can use console.log() statements in your test scripts to output messages to the console. This is a simple and effective way to debug your code, track the flow of execution, and ensure that your code works as expected.
  • Use browser.pause(): The pause() function allows you to suspend the execution of your test script at a specific point, giving you time to inspect the state of the browser and identify any issues.
  • Use browser.debugger(): Use browser.debugger() to stop the execution of your test script and launch a debugger in the browser. This can be useful if you want to step through your code and inspect variables.
  • Use the built-in.debugger(): The built-in debugger lets you step through your code and inspect variables. To use the debugger, start your test script with the --debug option, then launch the Chrome DevTools and select the Sources tab.

How do you generate Protractor reports, and what types of reports are available?

Protractor is a robust testing framework for Angular and AngularJS applications. It comes with a built-in reporting tool called Jasmine Reporters, which can provide several types of reports that allow you to analyze the results of your tests.

To generate reports with Protractor, you need to configure the Jasmine Reporters in your Protractor configuration file `(protractor.conf.js)`.

What are the prerequisites required to run Protractor?

To run Protractor, we must first have Selenium WebDriver and Node.js installed. We can download the Protractor package using npm.

How do Protractor, Selenium Server, and Selenium WebDriver work together?

Protractor, Selenium Server, and Selenium WebDriver are three tools used together to automate end-to-end testing of web applications.

Protractor, together with Selenium, provides an automated test infrastructure that can simulate a user's interaction with an Angular application running in a browser or mobile device.


Why did you choose Protractor when testing an application built on Angular or Angular JS and not Selenium?

Both the tools (Protractor & Selenium) can help you with flawless browser automation. When you use Angular or AngularJS to build your UI, there is no rule that you must use Protractor for browser automation. It depends on your team's skills and requirements.

You can use plain Selenium for testing Angular applications; however, Protractor makes it easier to test Angular applications by implementing the Page Objects pattern. Protractor uses Automatic Waiting for elements and allows you to access specific Angular elements by their models or bindings.

Can Protractor be used for testing Non-Angular JS Applications?

Protractor is designed specifically for testing Angular and AngularJS applications. It provides Angular-specific features such as automatic waiting for Angular to finish rendering and the ability to locate elements by their AngularJS-specific selectors. While Protractor can be used to test non-Angular JS applications, there may be better choices for this purpose.

When deciding whether to use Protractor for testing AngularJS applications, consider the following. These are some of the features that make Protractor a good choice for testing AngularJS apps.

  • Protractor is a wrapper around WebDriverJS and supports Behavior Driven Development frameworks such as Jasmine, Cucumber, Mocha, etc., making writing tests for your applications easier.
  • Protractor, a node.js program, works with the Selenium WebDriver to automate the testing of AngularJS applications. It offers some other new location strategies that simplify testing.
  • Protractor uses Selenium Grid to run multiple browsers simultaneously.

What are the test frameworks supported by Protractor?

Protractor supports two popular behavior-driven development frameworks, Jasmine and Mocha.

What is a conf file in Protractor?

In Protractor, a conf file is a JavaScript file used to specify configuration options for a Protractor test suite. The conf file is used to define settings such as the location of the test files, the browser to use for testing, and other options related to testing execution.

What is a spec file in Protractor?

In Protractor, a "spec" file is a JavaScript file that contains the actual test code that will be run by the testing framework (e.g., Jasmine or Mocha). The spec file can be placed in any directory, but it must be named to reflect the feature being tested.

How to exclude a spec file in Protractor?

You can exclude a spec file from a Protractor run by using the "--exclude" command line option. The "--exclude" option takes a comma-separated list of file names or glob patterns that should be excluded from the test run.

What is the use of directConnect in Protractor?

Protractor can test directly against Chrome and Firefox without using a Selenium Server. To take advantage of this feature, set `directConnect: true` in your config file.

`Direct` connection allows your test scripts to communicate directly with Chrome Driver or Firefox Driver, bypassing any Selenium Server. If you attempt to use a browser other than Chrome or Firefox, an error will be thrown. If this is true, settings for `seleniumAddress` and `seleniumServerJar` will be ignored.

What are the locators in Protractor?

Protractor, an end-to-end test framework for AngularJS applications, supports all of the element location strategies given by Selenium and offers unique locators for identifying elements based on AngularJS attributes.

How to add a custom locator for Protractor?

You can add a custom locator for Protractor by using `addLocator` method.

What is browser.refresh in Protractor?

`browser.refresh` loads a page in the current browser and then uses mock modules to simulate an Angular environment. It assumes that the page being loaded has Angular on load; if it does not, you can use the wrapped webdriver directly.

What is the difference between “GET” and “NAVIGATE in Protractor?

In Protractor, two methods are used to load a webpage: "GET" and "NAVIGATE." While these two methods have similar purposes, their functionalities differ slightly.

The `GET` method, commonly used when accessing HTML pages, loads a webpage by directly entering the URL of the page. The `GET` method works in much the same way as typing a URL into the address bar of your web browser.

On the other hand, the "NAVIGATE" method is used to navigate to a new page by clicking a link or button on the current page. When you use the "NAVIGATE" method in Protractor, the browser will simulate a user clicking on the specified link or button and loading the new page.

We can find all the links on a webpage using the tagName 'a'. All the links are formed with an anchor tag 'a', and all have an 'href' attribute with a URL value.

How do you verify tooltip text using Protractor?

By fetching the value of the 'title' attribute, we can verify the tooltip text using the Protractor.

What are the mouse actions that can be performed using Protractor?

The mouse actions that can be performed using Protractor are as follows:

  • click()
  • doubleClick()
  • contextClick()
  • mouseUp()
  • mouseDown(element)
  • mouseMove(element)
  • mouseMove(xOffset, yOffset)
  • dragAndDrop(element1, element2)

Why getText() method returns Object instead of String in Protractor?

To get the actual text, we need to resolve this Promise. When using Java, the `getText()` method will return the corresponding text from an element. However, in Protractor, the `getText()` method returns an object that looks something like [objectObject]. The syntax would be:

element.getText().then(function (text) { 

How to get a text from a textbox in Protractor?

To get the text from a textbox, use the `getAttribute()` method by passing the argument as a value. The `getAttribute()` method returns a promise which contains a String so that we can get the text from a textbox in Protractor. The syntax would be:

element(by.xpath("text box xpath").getAttribute("value")).then(function(textValue){

How do you verify whether an element exists on a webpage using Protractor?

We can use the following commands to determine whether an element exists on a webpage with the `isPresent` function. The syntax would be:

// Element exists
// Element not present

How to accept Alert in Protractor?

In Protractor, you can use the built-in `browser.switchTo().alert()` method to handle alerts. This method allows you to switch the focus of the browser to an alert dialog and perform actions on it, such as accepting or dismissing it. To accept an alert in Protractor, use the `accept()` method of the `Alert` object.

How to cancel Alert in Protractor?

To cancel an alert in Protractor, you can use the `dismiss()` method of the Alert object. This action can be performed by calling the `Alert.dismiss()` function or by simply typing `alert.dismiss()`.

The dismiss() method will close the alert dialog, whether or not it was triggered by a "Cancel" or "No" button.

How do you stop Page Loading in Protractor when an element is loaded?

In Protractor, you can use the `ExpectedConditions` class to wait for a specific element to be present or visible on the page before continuing your test. This can be useful if you want to stop the page from loading until a certain element is loaded and then proceed with your test to save bandwidth and increase speed.

What are the browsers supported by Protractor?

Protractor is designed to work with a variety of web browsers, including:

  • Google Chrome (recommended)
  • Mozilla Firefox
  • Microsoft Edge
  • Safari
  • Internet Explorer (IE)

How can I get using a Protractor for the current URL in testing?

You can get the current URL in Protractor by using the `getCurrentUrl()` method of the `browser` object. Here's an example:

// Navigate to a URL
// Get the current URL
                                            browser.getCurrentUrl().then(function(url) {
                                            console.log('The current URL is: ' + url);

This code will navigate to the specified URL and then use the `getCurrentUrl()` method to retrieve the current URL. The returned promise must be handled using `.then()`.

How to set the gecko driver path in Protractor?

Add a `capabilities` object to your configuration file to set the gecko driver path in Protractor. Here's an example for this:

exports.config = {
                                                // Other configuration options...

                                                capabilities: {
                                                    browserName: 'firefox',
                                                    'moz:firefoxOptions': {
                                                    // Set the path to the Gecko driver executable
                                                    args: ['--marionette', '--disable-popup-blocking', '--disable-extensions'],
                                                    binary: '/path/to/geckodriver'

                                                // Other configuration options...

In this example, we're using the capabilities object to set Firefox as the browser and point to the Gecko driver executable using the binary property. You can adjust the path to point to your Gecko driver executable's location.

How can we run the headless browser mode in Protractor?

We can use the`headless` option of the `chromeOptions` object to run in headless browser mode in Protractor. Here's an example:

exports.config = {
                                            // Other configuration options...

                                            capabilities: {
                                                browserName: 'chrome',
                                                chromeOptions: {
                                                args: ['--headless', '--disable-gpu']

                                            // Other configuration options...


This example sets the `capabilities` object to use Chrome as the browser, and it sets the `args` option to `['--headless', '--disable-gpu']`. The -headless switch tells Chrome to run in headless mode, and the `--disable-gpu` option is required for running Chrome in headless mode on some platforms.

Can we perform drag and drop in Protractor? If yes, write the code for it.

Yes, you can perform drag and drop actions in Protractor using the browser.actions() method. Here's an example:

// Find the source element to drag
                                            var sourceElement = element(by.id('sourceElement'));

                                            // Find the target element to drop onto
                                            var targetElement = element(by.id('targetElement'));

                                            // Perform the drag and drop action
                                            browser.actions().dragAndDrop(sourceElement, targetElement).perform();


To perform a drag and drop action, first, locate the source element that you want to drag by calling `element(by.id())`. Then, locate the target element that you want to drop onto. Finally, use the `browser.actions().dragAndDrop()` method to perform the drag and drop action, passing in the source and target elements as arguments.

Also Read: A list of 70 Cucumber Interview Questions and Answers

What are the types of failure in Protractor?

Several types of failures can occur in Protractor tests:

  • Element not found: When Protractor cannot locate an element on the page using the provided locator, this is called an element not found error. This can happen for several reasons, including a typo in your locator or an incorrect selector.
  • Timeout: Timeout occurs when Protractor waits too long for an element or condition to become true. This can be caused by a slow-loading page, a long-running script, or an element that never appears.
  • Assertion error: A test assertion failure occurs when a comparison between expected and actual values does not match. This can be caused by a bug in the application or a mistake in the test logic.
  • Network error: When Protractor encounters a network error, such as a timeout or connection failure, it will throw an error. This can be caused by a slow or unreliable network or by the server being down or unresponsive.

What are the various timeouts in Protractor?

Protractor is a widely used end-to-end testing framework for AngularJS applications. It includes several timeouts that can be configured to control how long Protractor waits for certain conditions to be met. The most commonly used timeouts are:

  • `implicitlyWait`
  • `pageLoadTimeout`
  • `scriptTimeout`
  • `allScriptsTimeout`
  • `waitForAngularEnabled`
  • `jasmineNodeOpts.defaultTimeoutInterval`

Can I use typescript with Protractor?

Yes, you can use TypeScript with Protractor. TypeScript is an extension of JavaScript that provides many valuable features for large-scale development projects. To use TypeScript with Protractor, you will need to install TypeScript and configure your project to use it.

How To Assert Something In Protractor?

You can use the expect function from the Jasmine testing framework in Protractor to assert that certain conditions are true. The `expect` function takes an actual value and a matcher function as arguments and returns an `Expectation` object that you can use to make assertions.

How do you handle timeouts in protractor tests?

In Protractor, timeouts can be handled in a few different ways depending on the situation. Here are a few examples:

  • Set timeouts in Protractor's configuration file
  • Use `browser.wait`

How do you test for user interactions, such as mouse clicks and keyboard inputs, with Protractor?

Testing user interactions such as mouse clicks and keyboard inputs is an essential part of functional testing. Protractor provides a set of functions that allow testers to interact with elements on the page programmatically. For example, to simulate a mouse click on an element, we can use the `click()` function of the `ElementFinder` object.

How do you test for data binding with Protractor?

In Protractor, testing for data binding is crucial for ensuring that the data displayed on the page is correctly bound to the application's data model. There are several ways to test for data binding with Protractor, and the approach taken will depend on the specific needs of the test.

One common approach to page validation is to read data from the page and compare it to the expected data. For example, suppose a field displays data that should be coming from a specific property of the data model. In that case, we can use the `getText()` function of the `ElementFinder` object to read that value from the page and then compare it against our expected value.

How do you test for animations and transitions with Protractor?

To test animations and transitions with Protractor, you can use the browser.wait() function to pause your tests until specific animation events occur.

What are the advantages of using Protractor for testing over manual testing?

One of the main advantages of using Protractor is the ability to automate testing tasks. Automating repetitive testing saves time and effort compared to manual testing, ensuring that all parts of the application are thoroughly tested.

Automated tests are more consistent and reliable than manual testing, which can introduce human error. Automated tests run the same way every time, regardless of who executes them. Consistency is essential when testing a large and complex application with many features.


Note : Learn how to debug Protractor tests for Selenium test automation with this detailed guide!

How do you generate test reports with Protractor?

Protractor provides built-in support for generating test reports using popular reporting frameworks like Jasmine and Mocha. This means that you don't have to worry about configuring these tools yourself, allowing you to focus on writing tests instead of building reports.

What is a Jasmine framework, and how does it integrate with Protractor?

Jasmine is a popular behavior-driven development (BDD) testing framework for JavaScript that provides a syntax for writing tests that is easy to read and understand. It is frequently used in conjunction with Protractor to test AngularJS applications.

Protractor, the newest addition to the AngularJS testing framework, integrates with Jasmine by providing a built-in Jasmine test framework adapter. This adapter allows Protractor to run Jasmine tests seamlessly and offers additional functionality for testing AngularJS applications.

How do you test for responsiveness with Protractor?

When testing for responsiveness in Protractor, you need to check how your application behaves and appears across different screen sizes and resolutions. You can follow these steps to check the responsiveness.

  • Use the `browser.driver.manage().window().setSize() method`.
  • Use the `browser.executeScript() method`.
  • Use the `browser.get() method`.
  • Use LT Browser 2.0, a developer-friendly browser.
Download Protractor Interview Questions

Note : We have compiled all Protractor Interview Question for you in a template format. Feel free to comment on it. Check it out now!!


Automated testing is essential to software development. Parallel Execution helps testers achieve maximum software quality faster, resulting in faster delivery of better applications. Angular applications, in particular, are best tested with Protractor and Selenium. As a result, we urge you to be careful when searching for job opportunities. We believe our efforts will pay off in your quest to ace the Protractor interview and land your dream job.


2M+ Devs and QAs rely on LambdaTest

Deliver immersive digital experiences with Next-Generation Mobile Apps and Cross Browser Testing Cloud

On this page

Frequently asked questions

  • General ...
  • LambdaTest related FAQs
How do you explain Protractor framework in interview?
Protractor is a tool for writing end-to-end tests for Angular and Angular JS applications. It interacts with your application in a real browser, as a user would. Protractor is a node.js port of the WebDriverIO framework, a JavaScript implementation of Selenium.
What are the basics of Protractor?
Protractor, a familiar testing framework for Angular and AngularJS applications, was built by a team at Google on top of WebDriver. We can see it as a replacement for the existing AngularJS E2E testing framework called Angular Scenario Runner.
Why Protractor is used instead of Selenium?
Protractor is a tool that lets you write tests for your AngularJS application using the popular Selenium WebDriver framework. It gives you access to all of the features of Selenium WebDriver and some AngularJS-specific features that make it easy to test complex components and interactions.

Did you find this page helpful?



Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud