When you encounter the "ERR_NAME_NOT_RESOLVED" error, it means the DNS server couldn't resolve the domain name. This can be due to incorrect DNS settings, network issues, or server problems. Here's how you can troubleshoot this issue:
Check your network connection: Ensure you have a stable internet connection and can access other websites.
Use the IP address: Find the IP address of the website using online tools like Ping or Traceroute. Enter the IP address in your browser's address bar and press Enter. If the website still doesn't load, there might be a server issue.
Contact the website administrator: If the issue persists, reach out to the website's support team for assistance.
In @playwright/test, you can handle such errors by using the page.waitForNavigation()
method with a timeout and catch the error. Here's an example:
import { test, expect } from '@playwright/test';
test('Handle ERR_NAME_NOT_RESOLVED error', async ({ page }) => {
try {
await page.goto('https://ray.run');
await page.waitForNavigation({ timeout: 5000 });
} catch (error) {
console.log('Error:', error.message);
// Handle the error or retry the navigation
}
});
This code snippet will attempt to navigate to the website and wait for navigation to complete within 5 seconds. If it fails, the error message will be logged, and you can handle the error or retry the navigation as needed.
If you still have questions, please ask a question and I will try to answer it.
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].