Q: What is better for testing a web application: Protractor or Selenium?
- link is on the downloads page from seleniumhq http://www.seleniumhq.org/download/
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.
- Protractor http://www.protractortest.org/#/
- 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
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:
- WebDriverIO - http://webdriver.io/
- WD.js https://github.com/admc/wd
- LeadFoot - https://theintern.github.io/leadfoot/index.html
- there are probably others
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.
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.