Protractor vs Selenium: Which Is Easier to Use?
Protractor once made Angular end-to-end tests easier to start. It reached end of life in 2023, so Selenium is the more supportable choice for new projects.
Protractor vs Selenium: Which Is Easier to Use? Historically, Protractor could feel easier for Angular end-to-end tests because it included Angular-aware waiting and a ready-made testing framework setup. For a new project today, Selenium WebDriver is the more supportable choice: Protractor reached end of life in August 2023, and its project discourages new adoption.
The short version: choose Selenium for new browser automation, including Angular apps. If you maintain a Protractor suite, plan a migration; Selenium’s JavaScript API is the closest path described by the Angular team, but calls and async behavior do not map one-to-one.
1. What each tool is
Protractor was an end-to-end testing framework for Angular and AngularJS applications, built on WebDriverJS. It combined browser control with test-oriented conventions and Angular-specific behavior.
Selenium WebDriver is a language-neutral interface for controlling browsers. You select a language binding and browser, then configure the matching driver. Selenium works across application types; it does not automatically understand Angular application stability.
2. Which is easier?
| Situation | Easier practical choice | Why |
|---|---|---|
| Starting a new test project | Selenium | Protractor is end of life and its maintainers discourage new projects from adopting it. |
| Historical Angular-only setup | Protractor could feel simpler | It supplied Angular-aware waiting and a familiar Node.js, Jasmine, configuration, and spec-file workflow. |
| Automating non-Angular sites or multiple languages | Selenium | WebDriver is language-neutral and is not tied to Angular. |
| Keeping an existing Protractor suite running | Neither is a quick drop-in answer | Continuing on an end-of-life framework carries maintenance risk; migration requires code changes. |
Ease depends on what “easy” means. Protractor reduced initial Angular-specific work. Selenium is easier to justify and maintain for new work because it remains the documented browser automation interface and supports choosing bindings for your project. There is no universal easiest language or setup: browser and language choice change the installation steps.
3. Why Protractor ended
The Angular team cited Protractor’s Control Flow promise model, which became a poor fit as JavaScript async/await matured. Selenium WebDriver 4 removed Control Flow support. Updating Protractor around that change would have required breaking changes and changes to existing tests. The team described automatic waiting for Angular stability as Protractor’s distinguishing feature over selenium-webdriver at that point.
“The only feature that differentiates Protractor from
selenium-webdriverat this point is the ability to automatically wait for the application under test to become stable (waitForAngularfeature in Protractor).”
That is the Angular project team’s explanation, not a guarantee that every app’s waits can be replaced with one identical Selenium call. See the official discussion of Protractor’s future.
4. Start a Selenium test in JavaScript
This minimal example uses JavaScript, Selenium’s WebDriverJS package, and Chrome. It opens a page, checks the title, and closes the browser even if an assertion fails. Install a current Node.js release, create a project, and install the binding:
mkdir selenium-example
cd selenium-example
npm init -y
npm install selenium-webdriver
Save this as example.js:
const assert = require('node:assert/strict');
const { Builder, Browser } = require('selenium-webdriver');
(async function main() {
const driver = await new Builder().forBrowser(Browser.CHROME).build();
try {
await driver.get('https://example.com');
const title = await driver.getTitle();
assert.match(title, /Example Domain/);
console.log(`Page title: ${title}`);
} finally {
await driver.quit();
}
})().catch((error) => {
console.error(error);
process.exitCode = 1;
});
Run it with node example.js. Selenium Manager can manage browser drivers for many standard local setups; if your environment uses a pinned browser, remote grid, container, or restricted network, configure the browser and driver according to that environment. The official Selenium getting-started guide covers the binding, browser, and driver prerequisites.
This sample demonstrates browser control, not a complete test suite. Add a test runner and assertions suited to your project. In real UI tests, prefer waiting for the state you need over fixed delays.
5. What the old Protractor setup looked like
Protractor’s tutorial is legacy documentation, useful only for understanding existing projects. It describes a Node.js/npm application, Jasmine tests, a spec file, a configuration file, and a local standalone Selenium Server. That server setup called for a JDK. These are historical setup details, not a recommendation to start with Protractor now.
For an existing repository, identify its Protractor and WebDriver versions, how the server and browser are launched, the test runner, and custom Angular waits before changing dependencies. Preserve a reproducible baseline of the tests and their environment so failures during migration can be separated from pre-existing issues.
6. Migrating Protractor tests to Selenium
- Inventory the suite. Find Protractor configuration, specs, plugins, browser capabilities, custom helpers, and CI commands. Note every use of Angular-specific locators and
waitForAngular. - Choose the Selenium binding and browser environment. For JavaScript migration,
selenium-webdriveris the closest API path cited by Angular. Confirm browser and driver versions in local development and CI. - Replace Control Flow assumptions. Make asynchronous operations explicit with
async/await. Do not assume old promise scheduling or implicit synchronization remains available. - Replace Angular-aware waits with observable conditions. Wait for the specific element, URL, text, or application state the test needs. For an Angular app, expose stable UI state or test hooks where appropriate; WebDriver itself does not provide Protractor’s automatic Angular stability wait.
- Translate APIs one at a time. Locators, browser setup, and helper methods may have close equivalents, but the Angular team cautions that replacement methods are not exactly one-to-one.
- Run incrementally. Migrate a small group of tests, compare results, then expand. Investigate timing-sensitive failures rather than adding broad sleeps.
Migration effort varies with suite size, custom helpers, Angular-specific synchronization, and the amount of Control Flow-dependent code. The closest API path reduces the conceptual jump; it does not make the migration automatic.
7. Choosing based on your project
- New Angular application: use Selenium WebDriver or another currently maintained test approach. Do not adopt Protractor for a new suite.
- Existing Protractor suite: keep its current execution reproducible while planning and validating a migration. Protractor’s end-of-life status means it is not a sound long-term default.
- Several languages or browser targets: select Selenium bindings and browser coverage around the team’s stack. The interface is language-neutral, but setup is binding- and browser-specific.
- Only need a screenshot of a page: a browser test framework may be more machinery than necessary. ScreenshotNeo is a website screenshot API and MCP server; it returns an image or PDF from a URL.
8. Or skip the browser setup
If the task is to capture a page rather than interact with it as part of a test, ScreenshotNeo can return a screenshot with one GET request. See the ScreenshotNeo API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://example.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({
access_key: 'YOUR_API_KEY',
url: 'https://example.com'
});
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
const image = Buffer.from(await res.arrayBuffer());
await require('node:fs/promises').writeFile('shot.webp', image);
Cookie and consent banners, newsletter popups, and chat widgets are removed before capture. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing; response headers report the page verdict and billing status. An MCP server provides screenshot tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. Visit ScreenshotNeo or sign up for 1,000 free screenshots a month, with no card.
9. Reliability, speed, and cost considerations
For WebDriver tests: browser startup, page loading, and synchronization all affect runtime. Reuse a deliberate test setup, keep waits tied to observable conditions, and collect browser and driver logs when diagnosing intermittent failures. A local browser and a remote browser grid have different setup and operational costs; the Selenium documentation does not establish one universal cost or speed comparison.
For screenshots: ScreenshotNeo’s billing rules distinguish clean captures from bot checks, blank pages, timeouts, failed loads, and cache hits, which are not billed. Responses identify verdict and billing through X-Page-Verdict and X-Billed headers. Use the headers to handle outcomes explicitly in automation. The available plans are Free: 1,000/month; Starter: $5 for 3,000; Growth: $15 for 15,000; Pro: $39 for 60,000; Scale: $99 for 250,000; Business: $249 for 1,000,000. Yearly billing gives two months free, and every feature is on every plan.
ScreenshotNeo offers controls for full-page and element captures, viewport and device presets, retina scale, dark mode, custom CSS and JavaScript, selector or network-idle waits, cookies and headers, caching TTL, async jobs, bulk capture up to 100 URLs per call, and PDF output. Use these when a capture workflow needs them; they do not turn a screenshot API into an interactive end-to-end test framework.
10. Common problems and fixes
| Symptom | Likely cause | What to do |
|---|---|---|
| Protractor install or browser setup fails on a new environment | The project is end of life and depends on an older stack. | For new work, use a maintained browser automation setup such as Selenium. For a legacy suite, document its runtime and browser versions while planning migration. |
| Selenium cannot start the browser | Browser missing, incompatible driver, or environment cannot provision the driver. | Install the chosen browser, check its version, and configure a matching driver or supported Selenium Manager setup. Check network and container restrictions. |
| A test races an Angular update | Selenium does not automatically wait for Angular stability. | Wait for the specific element or state that signals completion; expose a stable app condition if necessary. |
| Migration has unexpected async failures | Old code relied on Protractor Control Flow. | Use explicit async/await and await each WebDriver operation. Replace synchronization assumptions during migration. |
| A translated locator or helper behaves differently | Migration APIs are not exact one-to-one replacements. | Check the relevant Selenium binding documentation and test the translated behavior in isolation. |
| Screenshot response is not a usable image | The page may be blank, blocked, timed out, or otherwise unsuccessful. | Inspect X-Page-Verdict and X-Billed; adjust the target or capture settings and handle non-clean outcomes in the caller. |
| Screenshot is missing content loaded later | The page needs more time or a specific readiness condition. | Use an appropriate selector, delay, or network-idle wait; for lazy content, use full-page capture where suitable. |
11. Frequently asked questions
Can I still use Protractor?
Existing installations may still run in a compatible environment, but the project has reached end of life and discourages new adoption. Treat it as legacy software and plan a migration.
Is Selenium a direct replacement for Protractor?
It is the closest API migration path identified by the Angular team, but not a drop-in replacement. Angular-specific waits and Control Flow assumptions need attention.
Does Selenium only work with Angular?
No. WebDriver is a general browser-control interface and is not specific to Angular.
Is ScreenshotNeo an alternative to Selenium for testing?
It is an alternative for URL-based screenshot and PDF capture workflows. It does not replace interactive browser tests that click through an application and assert behavior.
