Hi all, I am trying to run my tests on mobile Safari but it looks like the application doesn't load at all and I get this error: "Error: page.goto: Couldn't resolve host name". The same for Desktop Safari.
I'm running the tests on Windows Server 2019, my config file has this project config for mobile: { name: 'Mobile Safari', use: { ...devices['iPhone 12'] }, }
I am behind a corporate proxy, however I have no issues running the tests on desktop Chrome (or mobile Chrome for that matter). Is there some additional config/setting I need to do for my tests to run on Webkit?
Thanks!
This thread is trying to answer question "Is there some additional config/setting I need to do for my tests to run on Webkit?"
Related Ask AI answer for "How do I configure my tests to run on WebKit using Playwright?".
Yes, you need to do some additional configurations to run your tests on WebKit using Playwright.
First, set up projects in your config file and add different options for each project. Here's an example:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
projects: [
{
name: 'webkit',
use: {
...devices['Desktop Safari'],
},
},
],
});
In this setup, we have a project named 'webkit' that uses the device parameters for 'Desktop Safari'. When you run your tests with npx playwright test
, Playwright will run all projects by default.
If you're behind a firewall or proxy, or if your network is slow to connect to the Playwright browser archive, you can configure environment variables like HTTPS_PROXY
, NODE_EXTRA_CA_CERTS
, and PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT
.
Remember, any test runner options should be specified at the top level in your configuration file, not in the use section. Some common options include specifying the test directory (testDir
), running all tests in parallel (fullyParallel
), and failing the build on CI if test.only
is left in the source code (forbidOnly
).
For more tips on writing efficient Playwright test scripts, check out this blog post.
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].