Introduction

Check if you can logingLogin with Salesforce

Step 1) Please download/fork the repository I saved in gitlab

https://gitlab.com/learnautomatedtesting/salesforceplaywright

In order to setup playwright to work with salesforce this is an example login script to work with the development application.

Run the following testscript

import { test, expect } from '@playwright/test';
import * as dotenv from 'dotenv';
// Load environment variables from .env file
dotenv.config();

test('has title', async ({ page }) => {
  await page.setViewportSize({ width: 1280, height: 720 });
  await page.goto('https://login.salesforce.com/?locale=nl');

  await page.fill('input[id="username"]', process.env.SALESFORCE_USERNAME as string);
  await page.fill('input[id="password"]', process.env.SALESFORCE_PASSWORD as string);
  await page.click('input[id="Login"]');
  await page.click('[class="slds-icon-waffle"]')
  await page.click('//p[text()="Service"]')


});

After this I am going to show you how to create a salesforce account