Skip to main content
Version: 1.1.4

Installation

Fast setup for Playwright-SAP.

Using npm, yarn or pnpm​

You can install Playwright-SAP using your preferred JavaScript package manager. The installation process will either initialize a new project or add Playwright-SAP to your existing project.

npm init playwright-sap@latest

Installation Options​

During installation, you'll be prompted to configure your project with the following options:

PromptWhat It DoesDefault
LanguageTS or JS projectTypeScript
Tests folderWhere tests gotests (or e2e fallback)
GitHub ActionsAdds CI workflowYes
Install browsersDownloads Playwright browsersYes

Understanding Package Aliasing​

Playwright-SAP uses a technique called package aliasing to seamlessly integrate with the standard Playwright API. This means:

  1. You'll import from @playwright/test in your code (the standard Playwright import)
  2. Behind the scenes, npm redirects this to the Playwright-SAP package
  3. This allows Playwright-SAP to extend Playwright without changing your imports

Your package.json will contain an entry like this:

package.json
"devDependencies": {
"@playwright/test": "npm:@playwright-sap/test@^1.1.4",
"@types/node": "^24.2.0"
}

The npm:@playwright-sap/test@^1.0.2 syntax tells npm to use the @playwright-sap/test package whenever code imports from @playwright/test.

Read more about package aliasing​

Add to an Existing Playwright Project​

Already have a Playwright test suite? You can drop Playwright-SAP in without rewriting any tests. Your existing imports like:

import { test, expect } from '@playwright/test';

continue to work exactly the same because we use npm package aliasing to substitute the underlying implementation. All core Playwright APIs keep their behavior; Playwright-SAP only augments them with SAP-aware locators/utilities.

1. Manually Edit package.json​

Open your package.json and in devDependencies (or dependencies if you put them there) replace any of these if present:

  • @playwright/test
  • playwright
  • playwright-core

with alias lines pointing to Playwright-SAP, e.g.:

package.json
"dependencies": {
"@playwright/test": "npm:@playwright-sap/test@^1.1.4",
"playwright": "npm:@playwright-sap/test@^1.1.4",
"playwright-core": "npm:@playwright-sap/test@^1.1.4"
// other deps...
}

(If you only had one or two of them, just change only those.)

2. Remove Lock File & Reinstall​

Delete the lock file so the alias is resolved cleanly, then install:

rm -f package-lock.json yarn.lock pnpm-lock.yaml
npm install

(Use yarn install or pnpm install if you prefer those.)

Now every import like import { test } from '@playwright/test' transparently uses Playwright-SAP—no code changes needed.

2. (Optional) Verify​

Run your current test suite—everything should pass as before:

npx playwright test

Getting Help​

If you encounter issues during installation:

  1. Check the FAQs for common problems and solutions
  2. Open an issue on GitHub

Next Steps​

After installation, you're ready to:

  1. Configure automatic SAP login for your tests
  2. Learn about specialized SAP locators
  3. Create your first test script