How to Use Browser Profiles for Authorized Web Automation Tests

How to Use Browser Profiles for Authorized Web Automation Tests

2024-11-21 06:00:00MoreLogin
Test a staging workflow with separate browser profiles for each role. Reuse authorized sessions, set concurrency and retry limits, and record why a run stopped.

Test the same order with two different roles

A release changes the order page in your staging store. A support agent should be able to read a test order, while a supervisor should also see its approval control. If both checks use the supervisor’s saved login, the test can pass even when the support view is wrong.

Use two named browser profiles for this check, one for each test role. Run it on a system your team owns or has permission to test. Before starting, agree with the owner on the staging URL, the test accounts, and whether the test may change any records. For this example, both roles only inspect the page. Neither submits an approval.

Prepare one reusable session per role

  1. Create two profiles in MoreLogin and label them Staging – Support and Staging – Supervisor. Give each role its own test account. Bookmark the approved staging address in both profiles.

  2. Sign in through the application’s normal login flow. If a test specifically checks sign-in or sign-out, start that test with a fresh session. For a test of the order page, reuse the relevant role’s authorized session while it remains valid.

  3. At the start of each run, check the hostname and the signed-in role before opening the test order. If either is wrong, stop the run. If the session has expired, end the run and renew it through the approved sign-in process.

  4. Write down the expected result for each role. For the support account, check that the order opens and the approval control is absent. For the supervisor, check that the same order opens and the control is visible. These checks cover the interface; they do not establish that the server enforces the same permissions.

If you save authentication state with Playwright, keep the file out of source control and restrict access to the test team. It can contain cookies or other credentials for the signed-in account. Playwright’s authentication guide


Here’s an example using MoreLogin + Playwright + Python to illustrate how automation with a fingerprint browser works:

  • Step 1: Install Playwright in your development environment.

  • Step 2: Copy the App key.

  • Step 3: Open the specified environment via the API.

  • Step 4: Connect Playwright to the browser environment just opened.

  • Step 5: Perform browser automation operations through the Playwright framework.

  • Step 6: Close the current environment.

Decide when the test should wait, retry, or stop

Start this two-role check with one worker and run the roles in sequence. That makes a failed result easier to reproduce. If the system owner approves parallel testing, set a maximum worker count for the entire run. Give parallel tests separate records whenever they can change order data.

What the test sees

What the runner should do

A read-only page load times out once

For this example, allow one retry after a short delay. If it fails again, stop that case and record both attempts.

The service returns 429 Too Many Requests

Pause all workers using that service. Honor Retry-After if supplied. If no waiting period was agreed, end the run and ask the owner when testing can resume.

A login prompt or CAPTCHA interrupts the order-page test

Stop the affected case and record where the prompt appeared. Have the test owner review the session before the next run.

The support account sees the supervisor’s approval control

Mark the test as failed. Record the role, order reference, and visible control without submitting the action.

A later test submits an update but receives no confirmation

Check the test order’s current state before considering another attempt. A timeout can occur after the server has already saved the change.

Leave enough detail for the next person to reproduce the result

Record the build, browser version, test role, test order reference, expected result, actual result, and attempt count. A useful failure note is: “Build 218, support role, order QA-1042: approval button visible; expected hidden. One attempt, no action submitted.” Keep credentials, cookies, and customer data out of the report.


Boosting Web Scraping Efficiency with Advanced Anti-Detect Browser

Previous

Playwright, Puppeteer, Selenium, Cypress: In-depth comparison and risk analysis of automated framework detection by websites

Next