Playwright Test Runner avatar
Playwright Test Runner
Try for free

No credit card required

View all Actors
Playwright Test Runner

Playwright Test Runner

jindrich.bar/playwright-test
Try for free

No credit card required

Run Playwright tests across numerous browser configurations with Apify. Create your tests in seconds and get comprehensive test reports faster than ever.

The code examples below show how to run the Actor and get its results. To run the code, you need to have an Apify account. Replace <YOUR_API_TOKEN> in the code with your API token, which you can find under Settings > Integrations in Apify Console. Learn more

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4client = ApifyClient("<YOUR_API_TOKEN>")
5
6# Prepare the Actor input
7run_input = { "testCode": """import { test, expect } from '@playwright/test';    
8    test('has title', async ({ page }) => {      
9      await page.goto('https://playwright.dev/');
10      // Expect a title \"to contain\" a substring.
11      await expect(page).toHaveTitle(/Playwright/);    
12    });
13    test('get started link', async ({ page }) => {
14        await page.goto('https://playwright.dev/');
15        // Click the get started link.
16        await page.getByRole('link', { name: 'Get started' }).click();
17        // Expects the URL to contain intro. 
18        await expect(page).toHaveURL(/.*intro/);    
19    });""" }
20
21# Run the Actor and wait for it to finish
22run = client.actor("jindrich.bar/playwright-test").call(run_input=run_input)
23
24# Fetch and print Actor results from the run's dataset (if there are any)
25print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
26for item in client.dataset(run["defaultDatasetId"]).iterate_items():
27    print(item)
28
29# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start
Developer
Maintained by Community
Actor metrics
  • 2 monthly users
  • 5 stars
  • 100.0% runs succeeded
  • Created in Feb 2023
  • Modified over 1 year ago