limited time offer

Protractor Interview Questions

Showing 1 - 10 of 42 results

What is the group index in XPath?

The group index is nothing but writing the XPath as a sequence. For example, XPath provides numbers from 1,2,3... for the element under every parent.

When we use an index, we might get end up having multiple elements when we wanted a particular element.

In such cases, the Group index will be more helpful to the user. Now the Group index numbers the element from 1..., even though element under the different parent.

The index numbers will never be repeated.

How to Select a Checkbox using Protractor?

We need to follow a few steps to make sure that the element is selected or not, Normally when we have this kind of scenario, what we do is, we will use click() method to select the checkbox. After this, we might move on to the next step of the scenario.

Sometimes not selecting will help you; you got to make sure that the checkbox is selected. To verify it we need to use the isSelected() method and get check whether it is really selected.

How do you run headless mode browsers in Protractor?

Headless browser doesn’t require a graphics driver at all, They just get commands and execute them directly in memory. To achieve this, you need to specify headless in configuration.js under capabilities.

Chrome

capabilities: {
  browserName: 'chrome',

  chromeOptions: {
	 args: [ "--headless", "--disable-gpu", "--window-size=800,600" ]
   }
}

Firefox

capabilities: {
  browserName: 'firefox',

  'moz:firefoxOptions': {
	 args: [ "--headless" ]
   }
}

What are the browsers supported by Protractor?

Protractor supports the two latest major versions of Chrome, Firefox, Safari, and IE. These are used in Protractor's own suite of tests. You can view the current status on Travis.

Note that because Protractor uses WebDriver to drive browsers, any issues with WebDriver implementations (such as FireFoxDriver, ChromeDriver, and IEDriver) will show up in Protractor. The chart below links to major known issues. You can search through all WebDriver issues at the Selenium issue tracker.

Driver Support
ChromeDriver Yes
FirefoxDriver* Yes
SafariDriver Yes
IEDriver Yes
OperaDriver No
ios-Driver No
Appium - iOS/Safari Yes**
Appium - Android/Chrome Yes**
Selendroid Yes**
PhantomJS / GhostDriver *

(*) WebDriver support fr Firefox has changed recently, and FireFox version 48 does not work properly with the current tools. For the moment, we recommend testing against FireFox 47. In future releases, support for WebDriver via Mozilla's Marionette project will be available.

(**) These drivers are not yet in the Protractor smoke tests.

(*) We recommend against using PhantomJS for tests with Protractor. There are many reported issues with PhantomJS crashing and behaving differently from real browsers.

How do you find Angular on your page?

Open chrome devtools or firefox and find if "angular" is defined. For AngularJS apps, the "angular" variable is expected to be available in the global context.

Note: Check your version of Angular is upgraded – Protractor supports Angular and AngularJS 1.0.6/1.1.4 and higher.

How to verify whether an element is enabled or not?

To verify whether an element is enabled or not, we use isEnabled() method in Protractor. isEnabled() method returns a Boolean value based on the state of the element. It returns true if the element is enabled and false if the element is not enabled.

Subscribe to Protractor Interview Questions