Top 100+ Protractor Automation Interview Questions And Answers
Question 1. What Is Protractor?
Answer :
Protractor is an give up-to-give up take a look at framework, designed for Angular and Angular JS packages. Protractor is a node.Js port of the webdriverio, that's the JavaScript implementation of Selenium framework.
Question 2. Why Protractor And Not Selenium With Any Other Language Like Java?
Answer :
It definitely relies upon on the choice of the crew and the benefit of the implementation for the QA group. There is a no tough and fast rule which you ought to use Protractor when the UI is constructed with Angular or Angular JS.
The real advantage for the usage of Protractor narrow down to the two principal points that I suppose need to be considered while identifying whether or not or not to use Protractor
Protractor handles the $http or $timeout synchronization troubles arising out of Angular/Angular JS very well.
Since Angular/Angular JS code is written in JavaScript/TypeScript, and Protractor supports each those languages, so there may be sync between the devs and QA while the usage of a single running language for FE in addition to the take a look at framework.
Testing Tools Interview Questions
Question three. What Are The Locators In Protractor?
Answer :
Apart from the fundamental locator mechanism that Selenium implementation offers , Protractor has some Angular JS precise locators.
By Binding
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
Custom Selectors
Question four. What Are Element Finder And Element Array Finder?
Answer :
The Protractor documentation mentions the difference in maximum easy manner:–
Element Finder:
The Element Finder virtually represents a unmarried detail of an ElementArrayFinder (and is more like a comfort object). As a end result, something that can be accomplished with an Element Finder can also be carried out the use of an ElementArrayFinder.
The Element Finder can be treated as a Web Element for most purposes; specially, you could perform moves (i.E. Click, get Text) on them as you'll a Web Element. Once an action is done on an Element Finder, the trendy end result from the chain may be accessed the usage of the then method. Unlike a Web Element, an Element Finder will wait for angular to settle earlier than appearing finds or moves.
Element Array Finder:
ElementArrayFinder is used for operations on an array of elements (rather than a unmarried detail).
The ElementArrayFinder is used to installation a sequence of conditions that become aware of an array of elements. In unique, you can call all (locator) and filter (filterFn) to return a new ElementArrayFinder changed through the conditions, and you may name get(index) to go back a unmarried Element Finder at function ‘index’.
Similar to jquery, ElementArrayFinder will search all branches of the DOM to discover the elements that fulfill the situations (i.E. All, clear out, get). However, an ElementArrayFinder will no longer absolutely retrieve the factors till an movement is known as, which means that it could be set up in helper documents (i.E. Page items) before the web page is available, and reused as the page adjustments.
SO, essentially, in case you’ve ever worked with Selenium within the past, you’d comprehend that it's far nothing however the difference among Find Element and Find Elements.
Testing Tools Tutorial
Question five. Can I Use Protractor For Non Angularjs Apps?
Answer :
Absolutely Yes. Protractor can be used for checking out non Angularjs or non Angular apps.
Agile Testing Interview Questions
Question 6. What Are Protractor, Jasmine, And Mocha? How Can We Use Them?
Answer :
Protractor, as described above, is the node.Js implementation of webdriver.Io, that's in turn the .Js implementation of Selenium. So in brief, it's miles in truth, the Selenium implementation in .Js optimised for Angular or Angular JS packages. It is the overall framework that gives with the baseline techniques and functions to engage with the HTML/DOM factors on a web web page.
Jasmine – It is a take a look at framework, like Junit (Java) and Unit Test (Python). It comes bundled with a variety of assertions and it's far the default framework when running with Protractor. Jasmine supports BDD- styled exams the usage of the describe- it syntax.
Mocha – Mocha is a check runner. Many humans confuse it with Jasmine as a check framework. It isn't a framework. Although it offers you numerous capabilities like a Test frameworks like hooks, the describe-it syntax, however it can't add assertions and other key unit checking out additives. You will continually need it to pair with something like chai or chai-as-promised.
Question 7. How To Assert Something In Protractor?
Answer :
It relies upon on the declaration framework you’re the use of. In general, maximum of the e2e implementation achieved is based totally out of the default Jasmine 2.0, which presents the declaration on this layout
expect (some thing).ToEqual (someotherthing).
In case you’re the usage of Mocha with a Chai as the announcement engine, you may use either of the 3 announcement types supplied via Chai as
anticipate (something).To.Identical (someotherthing)
some thing.Ought to.Identical (someotherthing)
assert.Equal (some thing, someotherthing)
Agile Testing Tutorial Selenium Interview Questions
Question eight. Explain How You Can Set Up Protractor In Your Project?
Answer :
It is very simple to installation Protractor to your assignment. Protractor is a node.Js program, so it is able to be easily hooked up through any package manager that supports node.Js set up – each npm and yarn are the cross-to bundle managers in maximum eventualities.
Your machine installation must have node.Js runtime mounted. Since npm comes by way of default with node.Js, so that you can use it or you can download and use yarn.
In case of npm, installing Protractor is only a remember of strolling this simple command – for node v.8.0+
npm i -g protractor or
npm deploy -g protractor
This command installs both Protractor and Web motive force-Manager. Once Protractor is established, you could check the model using
Protractor -model
Now, once Protractor is set up, you’ll not be geared up for jogging the exams but. You need the Chrome Driver or the Gecko Driver binaries for organising reference to the browser.
To gain this, you’ll want to run
Web motive force-manager update
This will installation the internet driving force-server at the side of the browser dependencies.
Once that is accomplished, you’ll have Protractor set-up to your project. Now the subsequent step is to jot down the check cases using the spec.Js document and set up the Protractor configuration the use of the conf.Js file.
Question nine. Can You Walk Me Through A Simple Set Up Of Protractor?
Answer :
This is similar or another manner of asking the identical query responded above. Just stroll thru a way to deploy Protractor inside the project.
Automation Testing Interview Questions
Question 10. I Do Not Want To Start The Selenium Server Every Time. How Can I Overcome This?
Answer :
In order to now not ought to try this, you want to set the direct Connect flag to real on your conf.Js document.
Selenium Tutorial
Question eleven. What Does Ignore Synchronization Do?
Answer :
In Protractor, whilst going for walks checks, this is a commonplace hassle, while the Protractor execution starts, but the Angular code remains trying to synchronise the $http or $timeout requests. Setting the browser.IgnoreSynchronization to true means that we’re telling Protractor to no longer look ahead to the Angular promises to be resolved.
Test Cases Interview Questions
Question 12. What Frameworks Can Be Used With Protractor?
Answer :
Protractor can be used with a variety of frameworks. By default, Protractor comes bundled with Jasmine 2.0. You also can pair Protractor to use mocha, Cucumber JS, Serenity.
If you want to apply it with another custom frameworks, then you may try this additionally.
Testing Tools Interview Questions
Question 13. How Can You Do Reporting In Protractor?
Answer :
Protractor doesn’t come bundled with any reporting device. However based on the framework which you’re the use of, you can use a whole lot of journalists. For eg, you could use Allure with Jasmine 2.0 with Protractor, Mochawesome when the usage of with Mocha and Cucumber specific reporters whilst operating with Cucumber.
Unittest Framework Tutorial
Question 14. Can I Use Protractor With Typescript?
Answer :
Absolutely Yes. You can use TypeScript with Protractor. There is a whole segment in Protractor doctors devoted to configuration and examples. You also can use this example to get configured.
Question 15. How Can I Add Custom Locator For Protractor?
Answer :
You can use the add Locator technique to do the same. Please undergo this pattern example to apprehend how it could be achieved.
Unittest Framework Interview Questions
Question sixteen. What Is The Default Time For A Protractor With Jasmine Spec To Fail And Can I Change It?
Answer :
By default, any spec in Protractor will fail after a period of 30 seconds because that is the default time out for a Jasmine spec to fail.
Yes, this timeout duration may be configured to be improved or decreased. In order to change the default timeout duration for all specs, you need to feature
JasmineNodeOpts: defaultTimeoutInterval: timeout in millis
To you conf.Js file, in which the second one option is the time period which you want to set.
Note: In case you’re the usage of with Mocha, this can be set the usage of mocha. Opts record.
Question 17. How To Run Multiple Specs In Protractor?
Answer :
In order to run multiple spec files in Protractor, you just need to mention them in the spec flag in an array.
For eg, allow’s say I have two special spec documents test1_spec.Js and test2_spec.Js, so I can try this
Specs: ['. /test/test1_spec.Js','./test/test2_spec.Js']
This will make Protractor run these more than one spec files.
Performance Testing Interview Questions
Question 18. Select A Checkbox Using Protractor?
Answer :
We need to observe few steps to make sure that detail is selected or not, Normally whilst we have this type of eventualities what we do is, we are able to use click() method to pick out the test field. After this we'd circulate directly to subsequent step of state of affairs.
Sometimes no longer selecting will assist you; you acquire to make certain that the checkbox is selected. To confirm it we want to apply the is Selected () technique and get take a look at whether it's miles surely selected.
Agile Testing Interview Questions
Question 19. What Is The Good Reporter In Market For Protractor?
Answer :
As of now, we can say chercher-tech-jasmine-reporter is greater suitable document for the protractor and Jasmine combination.
Question 20. What Is Group Index In Xpath?
Answer :
Group index is nothing however writing the XPath as sequence. For instance, XPath provides numbers from 1, 2, three... For detail below every parent.
When we use index we'd get turn out to be having multiple factors when we wanted a particular element.
In such cases the Group index may be greater useful to the consumer. Now the Group index numbers the detail from 1..., despite the fact that detail underneath unique determine.
The index numbers will in no way be repeated.
Test Plan Interview Questions
Question 21. How Do You Handle A Text Area Element?
Answer :
Textarea does not have plenty difference from textual content bar, so we are able to manage it like normal textual content box/text bar detail.
Question 22. How To Handle The Installation In Protractor (pick out Has Maven For Installations)?
Answer :
It is not just for maven; t is for all node js software. We can use the bundle.Json document as set up files, whilst we specify a model in bundle.Json then node will installation the desired model in our device.
Package.Json not just stops with installation it also carry out operation like compiling, going for walks the exams.
Question 23. How Can We Find All The Links On A Web Page?
Answer :
All the links are formed the use of anchor tag 'a' and all links will have href attribute with URL fee. So by means of finding factors of tag Name 'a' we are able to locate all the links on a website.
Test Automation Framework Interview Questions
Question 24. How To Verify Tool Tip Text Using Protractor?
Answer :
Web factors have an characteristic of kind 'identify'. By fetching the cost of 'title' attribute we are able to affirm the tooltip textual content in protractor.
Selenium Interview Questions
Question 25. What Are The Different Mouse Actions That Can Be Performed?
Answer :
Click (detail)
Double Click (element)
Context Click (detail)
MouseDown (detail)
MouseUp (detail)
MouseMove (element)
MouseMove (detail, long xOffset, lengthy yOffset)
Drag And Drop ()
Question 26. Write A Code To Wait For An Alert To Appear?
Answer :
Waiting for an alert to appear on a page can be carried out using express wait in protractor.
Browser. Wait (ExpectedConditions.AlertIsPresent (), 30000)
Question 27. Write A Code To Wait For A Particular Element To Be Visible On A Page Using Protractor?
Answer :
Visibility way that the element isn't best displayed but additionally has a peak and width that is greater than 0. You can use visibility of characteristic to test the visibility of the detail
Let EC = Expected Conditions;
Let condition = EC.VisibilityOf (element (by means of.Identification ("hidden")))
Browser. Wait (situation, 30000)
Automation Testing Interview Questions
Question 28. Can Protractor Handle Windows Based Pop Up?
Answer :
Protractor is an internet automation testing tool which helps only net application checking out. Therefore, windows pop up can not be treated the usage of Protractor.
Question 29. Return Javascript Execution Result?
Answer :
We need to return out of your javascript snippet to return a fee, so: browser.ExecuteScript ("file. Name"); will return null, but: browser.ExecuteScript ("return file. Identify"); will return the title of the record.
Question 30. What Are The Advantages Of Automation Framework In Protractor?
Answer :
Re-usability of code
Maximum coverage
Recovery state of affairs
Low fee maintenance
Minimal manual intervention
Easy Reporting
Logging for debugging
Easy Coding
Question 31. What Is An Xpath?
Answer :
XPath or XML route is a query language for selecting nodes from XML documents. XPath is one of the locators supported by Protractor.
Selenium internet driver helps best XPath 1.Zero, selenium does not aid XPath 2.Zero, three.Zero
Question 32. What Is The Order Of Fastest Browser Implementation For Protractor?
Answer :
HTML Unit Driver is the quickest browser implementation because it does no longer includes interplay with a browser; this is observed through Firefox motive force after which IE motive force that's slower than FF driver and runs handiest on Windows.
Question 33. What Are The Prerequisites To Run Protractor?
Answer :
JDK, Web Driver (selenium standalone jar record), browser, utility to be examined.
Test Cases Interview Questions
Question 34. What Are The Web Pages Elements In Web Applications?
Answer :
Link Button Image, Image Link, Image Button Text field Edit Box Text Area Check box Radio Button Drop down field List container Combo field Web desk /HTML desk Frame.
Question 35. What Is The Difference Between Browsers. Close () And Browser. Quit () Command?
Answer :
Close (): Protractor close () technique closes the internet browser window that the consumer is presently operating on or we can also say the window this is being currently accessed by way of the Web Driver. The command neither requires any parameter nor does is go back any cost.
Quite (): Unlike near () approach, quit() method closes down all the home windows that this system has opened. Same as near () technique, the command neither requires any parameter nor does is return any fee.
Question 36. What Is Element Finder?
Answer :
The Element Finder is not anything however factors present in the web page, we will get this as result of detail (with the aid of. Locator ("locator fee"))
Element Finder can be used to construct a series of locators this is used to discover an element.
An Element Finder does not simply try to discover the element till an action is called, which means that they can be installation in helper files earlier than the page is available.
Unittest Framework Interview Questions
Question 37. Test Case Failed Saying "element Not Visible", But When Analyzed Manually Element Is Visible? How To Handle It?
Answer :
There are couples of factors which might also cause this problem.
Element might not be seen in automation because of the velocity of selenium.
If you closed a hidden department pop up, and attempted to perform action, then there is a danger that hidden division popup' animation went over that may reason this trouble.
There is will be an every other element which has equal XPath or locator in some other page.
Example: Consider you have got an detail which has XPath as //button [@id='abc'] on web page X, via clicking some tab on page navigates the user to MY page, Now there may be an detail on Y page that have XPath same as //button [@id='abc']. But whilst you release your application, application may be at once landed on web page Y. So with this situation, if you attempt to perform on element on Y page it could throw an Error.
Question 38. Explain What Is Time-out Test In Protractor?
Answer :
The Time-Out test in Protractor is not anything however time allotted to carry out unit trying out. If the unit check fails to complete in that unique time restriction, protractor will abandon further trying out and mark it as a failed.
Question 39. How To Wait For Element To Be Available In Angular Applications?
Answer :
The software might also load some elements late and your script wishes to stop for the detail to be to be had for subsequent movement.
In underneath protractor code, the script goes to wait maximum 30 seconds for the detail to be to be had. Feel loose to change the maximum variety consistent with your software wishes.
Browser.Wait (ExpectedConditions.PresenceOf (element (with the aid of.Id ("detail-id"))), 30000)
Question forty. What Is The Difference Between "get" And "navigate" To Open A Web Page In Protractor?
Answer :
Get method gets a web page to load or get web page supply or get textual content it truly is all whereas navigate will manual thru the history like refresh, lower back, forward.
For example if we need to move ahead and perform a little functionality and returned to the house web page this can be accomplished via navigate() simplest.
Browser. Get () will wait until the whole web page gets loaded and browser. Navigate () will just redirect to that web page and will now not wait.
Performance Testing Interview Questions
Question forty one. Difference Between Flex And Flash Application?
Answer :
In flash there is no code just primarily based on creativity(design) we are able to entire the work(time consuming technique) while flex incorporate a few small features that is incorporated with mxml,PHP..(No device is there to increase flex we need to apply the homes of css and style sheet)
