Registry / testing / salesforce-pageobjects

salesforce-pageobjects

JSON →
library12.0.0jsnpmunverified

Salesforce Page Objects provides pre-built page objects for testing Salesforce Lightning Experience applications using the UI Test Automation Model (UTAM) framework. This package, currently at stable version 12.0.0, is directly provided by Salesforce and is compatible with the Spring’26 Salesforce release, ensuring alignment with the latest platform features. It is designed to work with the `wdio-utam-service` (specifically versions 3.0.0-3.3.0 for web, and 3.0.0-3.2.2 for mobile) to facilitate robust UI testing. The library offers a structured way to interact with Salesforce UI components, abstracting the underlying DOM for more resilient and maintainable tests. Its release cadence is tied to Salesforce platform releases, providing updated page objects as the platform evolves, differentiating it from community-maintained alternatives by offering official, curated test components.

npm install salesforce-pageobjects
INSTALL
IMPORT
SIG · SALESFORCE-PAGEOBJ
S
salesforce-pageobjects
testingjavascriptv12.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Login
import Login from 'salesforce-pageobjects/helpers/pageObjects/login';
const Login = require('salesforce-pageobjects/helpers/pageObjects/login');
Use this import style for ES Modules (ESM). Node.js >=18 natively supports ESM. Page objects are typically exported as default from their specific paths.
AccountHomePage
import AccountHomePage from 'salesforce-pageobjects/helpers/pageObjects/accountHomePage';
Example of importing another specific page object. Paths generally follow a `package/helpers/pageObjects/ComponentName` pattern, reflecting the UI structure. These are default exports.
Login
const Login = require('salesforce-pageobjects/helpers/pageObjects/login');
import Login from 'salesforce-pageobjects/helpers/pageObjects/login';
Use this import style for CommonJS (CJS) environments. While Node.js >=18 supports ESM, legacy projects or specific configurations may still require CommonJS syntax.

Demonstrates importing the Login page object, instantiating it with UtamLoader, and performing basic interactions like field existence checks and logging in.

import Login from 'salesforce-pageobjects/helpers/pageObjects/login'; import { UtamLoader } from 'wdio-utam-service'; // Required for UTAM page object instantiation // This example typically runs within a WebdriverIO test file or similar testing framework describe('Salesforce Login Page Test', () => { let loginPage: Login; beforeAll(async () => { // 'browser' is assumed to be a global object provided by WebdriverIO await browser.url('https://login.salesforce.com/'); // Navigate to your Salesforce login URL loginPage = await UtamLoader.load(Login); // Instantiate the Login page object }); it('should display username, password fields and login button', async () => { await expect(loginPage.getUsername()).toBeExisting(); await expect(loginPage.getPassword()).toBeExisting(); await expect(loginPage.getLoginButton()).toBeExisting(); }); it('should be able to log in with example credentials', async () => { // Replace with actual test credentials or environment variables const username = process.env.SF_USERNAME ?? 'test@example.com'; const password = process.env.SF_PASSWORD ?? 'MySecurePassword123!'; await loginPage.login(username, password); // Use the page object's login method // Assert navigation to a post-login page or URL await expect(browser).toHaveUrlContaining('lightning.force.com'); }); });
Debug
Known issues
breakingThis package requires Node.js version 18 or higher. Running with older Node.js versions may lead to installation failures or runtime errors.
fix
Upgrade your Node.js development and execution environment to version 18 or a later compatible version.
affects: >=12.0.0
gotchaStrict version compatibility with `wdio-utam-service` is required. Version 12.0.0 of `salesforce-pageobjects` is compatible with `wdio-utam-service` versions `3.0.0` to `3.3.0` for web applications, and `3.0.0` to `3.2.2` for mobile applications.
fix
Ensure your `wdio-utam-service` dependency matches the specified compatible version range to avoid runtime issues with page object loading and interaction.
affects: >=12.0.0
gotchaPage objects are tied to specific Salesforce releases. Version 12.0.0 is compatible with the Spring’26 Salesforce release. Using this package with different Salesforce org versions (older or newer) may result in outdated locators and failed tests.
fix
Align your `salesforce-pageobjects` package version with your Salesforce org's current release. Regularly check for package updates corresponding to new Salesforce releases.
affects: >=12.0.0
Errors
Common errors & fixes
Error: Cannot find module 'salesforce-pageobjects/helpers/pageObjects/login'
The module path is incorrect, a typo exists, or the package is not correctly installed or linked.
fix
Verify the exact import path, including case sensitivity. Ensure `salesforce-pageobjects` is installed via `npm install salesforce-pageobjects` and is accessible in your project's `node_modules`.
TypeError: loginPage.getUsername is not a function
The page object was not correctly loaded and instantiated through the UTAM loader, or the method name is incorrect/non-existent.
fix
Ensure `UtamLoader.load(Login)` is used to create the page object instance. Double-check the method name against the UTAM page object definition or documentation for `Login`.
WebDriver Error: element not found
The UI element targeted by the page object's locator is not present on the page, often due to changes in the Salesforce UI or an outdated page object definition.
fix
Confirm that your `salesforce-pageobjects` version matches your Salesforce org's release. If the problem persists, inspect the element using browser developer tools to verify its presence and attributes, or await a package update with refreshed locators.
Upgrade
Version history
12.0.0latest on npm
Audit
Dependencies
wdio-utam-servicerequiredRequired for instantiating and interacting with UTAM page objects in a WebdriverIO testing environment.
Agent activity
4 hits · last 30 days
node
4
Resources
salesforce-pageobjects — npm install salesforce-pageobjects · libregistry