Skip to main content

3 minute read - Quora Test Automation

What is better for testing a web application - Protractor or Selenium? Quora Answer

Jul 15, 2017

Q: What is better for testing a web application: Protractor or Selenium?


Every time I’ve automated Web Applications, when coding in JavaScript, I have used the ‘core’ JavaScript library provided by the WebDriver team WebDriverJS:

I use this because it keeps up to date with the main selenium code base and if you want help on the Selenium forums this one is likely to receive answers there.

This is not your only choice when working with JavaScript:

  • Protractor
    • created by the Angular JS team
    • designed to be used for Angular apps because it has built in synchronization for Angular applications
    • protractor is built on WebDriverJS
    • If your application is written using Angular, and you are writing your test execution code in JavaScript and you don’t have much experiencing automating web applications then this might be a good choice because of the default synchronisation and the documentation is based around Angular applications.

This might not be the best choice for non-angular applications because you may prefer more specific synchronisation approaches and the API might not be as flexible as you need.

If you want to use the most up to date version of WebDriverJS then you have a dependency on Protractor updating to use it, but I think this usually happens fairly quickly.

You also have:

You will have to evaluate them to see which:

  • works best in your environment
  • offers and API that fits your coding style

Generally I try to work as close to the core library as possible to have as few dependencies on other projects as I can, and also I don’t find the main WebDriver API hard to use.

You can test Angular applications without Protractor, but you have to write code to synchronise your application effectively.

Since Protractor is open source you can read the source to understand their synchronisation mechanisms if you choose to use a different JavaScript library.

If you prefer coding in another language e.g. Java or C# then look at the download page on selenium hq and start with the official bindings.

If you find them hard to use then you might want to look for a library that sits on top of WebDriver, for that language, which offers a ‘framework’ or higher level abstraction to work with.

The benefits of sticking as close to ‘core’ library as possible are that you will find it easier to switch between different languages when coding WebDriver tests as the APIs are very similar, and you are learning WebDriver, rather than learning a separate framework or library.

See more on Quora

Read this on Quora

You will need a Github account to comment. Or you can contact me with your comment.

I reserve the right to delete spam comments e.g. if your comment adds no value and its purpose is simply to create a backlink to another site offering training, or courses, etc.