Basic interview questions

What is ElementFinder ?

The ElementFinder is nothing but elements present in the webpage, we will get this as result of element(by.locator("locator value"))

ElementFinder can be used to build a chain of locators that is used to find an element.

An ElementFinder does not actually attempt to find the element until an action is called, which means they can be set up in helper files before the page is available.

What is WEbElement in Protractor?

When we perform any action on the ElementFinder, protractor converts it into WebElement and perform the operation.

We can convert the ElementFinder into WebElement using getWebElement() command present in the protractor. Every method calls this method internally before performing operation on the webpage object

// below code convert the Element finder to WebElement before performing
// click operation

// getWebElement

Check If An Element Exists in Protractor ?

Get the all the matches for that locator and the value should be more than 0 if it is zero then there no such element in the we page

You can use below protractor code snippet to check if a element with id 'element-id' exists on web page.

		console.log("element is present")
		console.log("element is not present")

How to disable a test case in Jasmine With Protractor ?

To disable the test case we use the make the it block in to xit block in jasmine

xit("test description)			

Explain what is Time-Out test in Protractor?

The Time-Out test in Protractor is nothing but time allotted to perform unit testing. If the unit test fails to finish in that specific time limit, protractor will abandon further testing and mark it as a failed.

How To Check If An Element Is Visible With Protractor?

We can use isDisplayed() method to check whether a element is visible or not. You can check whether an element is visible or not using below code.

		console.log("element is Visible")
		console.log("element is not visible")

How to wait for element to be available in angular applications ?

The application may load some elements late and your script needs to stop for the element to be available for next action.

In below protractor code, the script is going to wait maximum 30 seconds for the element to be available. Feel free to change the maximum number per your application needs.

browser.wait(ExpectedConditions.presenceOf(element("element-id"))), 30000)	

How to Focus On A Input Element On Page using protractor ?

Doing focus on any element can be easily done by clicking the mouse on the required element. However when you are using selenium you may need to use this workaround instead of mouse click you can send some empty keys to a element you want to focus.

let webElement  = element("element-id"));
//Send empty message to element for setting focus on it.

How to Overwrite Current Input Value in editable field On Page using protractor ?

The sendKeys method on WebElement class will append the value to existing value of element. If you want to clear the old value. You can use clear() method.

let webElement = element("element-id"));
webElement.sendKeys("new input value");		

Intermediate level protractor interview questions

How do you accept alert in protractor ?

We can accept the alert using accept methods present in the Alerts class. But before accepting the alert we have to switch the control to the alert in protractor


How do you cancel alert in protractor ?

To close or cancel the alert we have to switch to the alert using switchTo().alert() method and then we have to use dismiss() method to cancel the alert using protractor


How do you set value to prompt alert in protractor ?

we can use sendkeys method present in the alert class to set value in the p type of alert in protractor


Conf file related protractor interview questions

How do you execute a spec file both in chrome and firefox ?

We can execute same file in multiple browsers using the shardTestFiles , we have to set this parameter as false and we have to enable the chrome and firefox browsers in Multi-capabilities block.

shardTestFiles: false,
multiCapabilities: [{
  'browserName': 'chrome',
} , {
  'browserName': 'firefox',

Basic Protractor Interview Question

Can we set global variables in Protractor ?

we can set global variable in protractor using params present in the conf file.

Normally we set urls, usernames, passwords in this params

params: {
	login: {
	  email: 'default',
	  password: 'default'

what are the testing frameworks available for protractor ?

Jasmine : Jasmine is the most preferred test framework when Protractor is installed. We will use Jasmine in this article.

Mocha : Mocha is a JavaScript test framework which runs on Node.js. If you wish to use Mocha as your test framework, you will have to set it up with your Protractor

What is Jasmine ?

jasmine is javascript testing framework, we can use jasmine along with framework to test the web application.

It has features like beforeEach, afterEach, beforeAll, afterAll, it block and we can combine it blocks and describe blocks

How do you handle dropdowns in protractor ?

In selenium we have Select class to handle the dropdowns but in protractor doesnot have such helper classes.

To select a value in dropdown, we have to click the dropdown and then we should click the option inside the dropdown.

What is conf file ?

Conf file is the starting point of the protractor execution, conf file helps user to set the browser and pre-execution steps in protractor. We will configure grid details in protractor

How do you exclude a spec file in protractor ?

We can exclude test files using exclude parameter in conf.js file. Exclude parameter will be useful when you do not want to run only few tests or a folder.

Exclude also accepst Array as parameter values, also responds to regular expression.

										exclude: ['D:\\Protractor Demo\\specs\\dummytest.js']

How do you open firefox in protractor, which is installed in custom path ?

Sometimes the firefox might be installed in some custom path, in those cases firefoxPath in the conf.js file helps us to set the path to the firefox.exe file.

This woud be very useful if you are trying to perform version testing.

											firefoxPath: "C:/Program Files/Mozilla Firefox/Firefox 54/firefox.exe",

What is maxInstances in protractor ?

Maximum number of browser instances that can run in parallel for this set of capabilities. This is only needed if shardTestFiles is true in conf.js file

What is Typescript ?

Typescript is programming language, and it is supet set of Javascript. Typescript provides syntaxes like Java/Python but also it provides javascript function.

End of the day Typescript is converted into javascript and executed with protractor.

It is easy to learn typescript than javascript.

Why do we need protractor ?

What is directConnect in protractor conf.js file ?

directConnect is a conf.js file parameter, If true, Protractor will connect directly to the browser Drivers at the locations specified by chromeDriver and firefoxPath.

Only Chrome and Firefox are supported for direct connect.

											directConnect: false/true,

How do you set the geckodriver path in protractor ?

geckoDriver location is used to help find the geckodriver.exe file. This will be passed to the Selenium jar as the system property webdriver.gecko.driver.

If the value is not set when launching locally, it will use the default values downloaded from webdriver-manager.

											geckoDriver: 'D:/Eclipse progs/driverserver/geckodriver.exe',

Protractor Interview Questions

Join My Facebook Group
Join Group

About Author

Myself KarthiQ, I am the author of this blog, I know ways to write a good article but some how I donot have the skills to make it to reach people, would you like help me to reach more people By sharing this Article in the social media.

Share this Article Facebook
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions
Copyright © CherCher Tech