Differences between selenium and protractor

In this tutorial, we will try to explore the major difference between selenium and protractor ..

Application of testing in Selenium and Protractor :

We automate the web applications using the selenium webdriver with java or with language of choice. People might say that use protractor when the web application is built on angular application, that is bullshit.

We should go for Protractor only when your team does not have skill to handle the ajax & angular waits using fluent wait in selenium.

In similar manner, you can use the protractor to automate the non-angular application, just by setting browser.ignoreSynchronization = true.

One more myth about automation, you should automate using the same language as development language. Please do aware that application development language does not have any effect on web browser, because web browser renders the only UI using HTML, CSS, JS.

So when you compare selenium & protractor based on application then you will not get justification to choose one tool.

Language of Choice Selenium and Protractor :

When you are hiring people for automaton jobs, you should be getting more of java people but less of typescript people because people who know typescript tries to get job in development not in testing.

So you might get java people for automaton, instead of training them on protractor training them on waits in selenium, so that you could you selenium as your automation too.

Selenium support: java,python kotlin, c, c#, Php.
Protractor supports: Typescript and JavaScript (basically all js related languages).

Unit Testing Framework Selenium and Protractor :

When we choose between selenium and protractor we also should mind about the unit testing framework that we are going to use.

Selenium supports many unit testing frameworks, TestNg and Junit are two important unit testing frameworks

Protractor Supports Jasmine and Mocha frameworks and also protractor woks well with chai assertions.

When we compare the TestNG and the Jasmine , TestNG wins as TestNg has below advantages over Jasmine:

  • We can execute the test cases sequentially even when test cases are not in sequentially aligned but protractor executes based on the position of the Test case (Where the code is written)
  • Priority in TestNG plays major role in executing the test cases in order, no priority in Jasmine test cases
  • With just right click you can generate the testng.xml(runner), but you got to write the conf file manually for Jasmine
  • You can run the test cases using a condition in TestNG but not possible in Jasmine
  • Parallel run occurs based on the Tests, classes in TestNG but Jasmine runs the files in Parallel (if you have 1000 test cases in single file then you cannot run them in parallel, all 1000 will get executed only sequentially)

Selenium vs Protractor Code length:

Another obvious difference is the code length, we will be able to achieve the target in less number of lines in Java with selenium.

Code length is more because all of the fetch operation return promise, so you got to solve the promises first, so the code length is more.

Remote Execution in Selenium and Protractor:

Both selenium and protractor runs remote execution using the selenium server jar, so there is not much difference in the grid. The only change would be the configuration for the grid and choice of browser.

protractor vs selenium performance:

Comparing the performance selenium is faster than Protractor on the normal application but protractor is faster than selenium in angular application.

Protractor got inbuilt waits for angular and ajax calls, but we have to define the waits in selenium to handle angular and ajax.

protractor vs selenium speed is not comparable as their strategies are different.

selenium ide vs protractor:

I know this comparison should not be here but let's see this as well. Selenium IDE (SIDE) , is browser based to this will be installed an add-on to browser. W can use the SIDe for recording the actions an then perform it on the application. SIDE is not flexible as selenium Webdriver.

Protractor has no recording option but more flexible when compared with SIDE. SIDE support the non-angular apps in good way but not angular apps.

protractor vs Jasmine:

Protractor is a testing tool but Jasmine is unit testing framework. Jasmine performs the operations, Jasmine helps to structure those operation as test cases.

protractor supports all the nodejs based unit frameworks like Jasmine, Mocha, chai(assertion library), Karma(runner), here the karma is not bi***.

Jasmine vs Cucumber:

We can write the tests in Jasmine as like cucumber in a descriptive way, but Cucumber is a different kind when compared with Jasmine

Cucumber works based on the gherkin file descriptions, and it will have separate step_definitions.

We cannot use the combination of cucumber and Jasmine. These are the key differences between protractor and selenium

protractor vs selenium ppt:

You can download the protractor vs selenium ppt by clicking

protractor vs selenium pdf:

You can download the protractor vs selenium pdf by clicking

Protractor Interview Questions

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions
  • Mallikarjuna
    Hi Pavan, can you guild me how to debug the script VS Code. I have added "Debugger for chrome" extension but no luck. only URL is launching but no debug or run after that.
  • Protractor Training

    new tutorial I am starting new Protractor training batch on Weekends. It is two days course from 01-june-2019 to 02-june-2019 based on class room (BANGALORE)

    Interested people can confirm the seat by calling to +91 8971673487 or whatsapp to +91 9003381224

    Find the course content : View Content