The following guide covers the Playwright integration process with Oxylabs Datacenter and Residential Proxies.
What is Playwright?
Playwright is a convenient library for automation and testing purposes. It can work with web browser interactions, e.g., navigating to URLs, entering text, clicking buttons, extracting text, and more.
Playwright works with the most popular browsers, such as Google Chrome and Chromium, Microsoft Edge, Firefox, and Safari (when using WebKit.) Moreover, it supports various programming languages such as Node.js, Python, Java, and .NET.
Click the video below if you'd like to see the integration process on YouTube:
Before getting started with Playwright, you'll need to install a few basic tools: Node.js and a code editor of your choice. After that, create a Node.js project and install the required packages. You may find a detailed guide on how to install and run Playwright on our blog post.
Once everything is set up, we can move on to the next part – Oxylabs' Proxies integration with Playwright.
If you’re using our Residential Proxies, follow these steps:
1. Fill in the Proxy IP:Port in the server value, for example:
http://pr.oxylabs.io:7777
2. Next, input your Oxylabs proxy sub-user's username and password. The code example of a Playwright proxy authentication looks like this:
const playwright = require('playwright');
(async () => {
for (const browserType of ['chromium', 'firefox', 'webkit']) {
const browser = await playwright[browserType].launch({
headless: false,
proxy: {
server: 'http://pr.oxylabs.io:7777',
username: 'USERNAME',
password: 'PASSWORD'
},
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://ip.oxylabs.io');
await page.screenshot({ path: `${browserType}.png` });
await browser.close();
}
})();
3. You can also use country-specific entries. For example, if you put us-pr.oxylabs.io under Host and 10001 under Port, you'll receive a US exit node. Please check our documentation for a complete list of country-specific entry nodes and sticky sessions details.
If you’re using Shared Datacenter Proxies, fill in the Proxy IP:Port in the server value as shown:
dc.pr.oxylabs.io:10000
2. Enter your Oxylabs proxy sub-user's username and password in dedicated values.
3. If you want to use a country-specific node, you’ll simply have to adjust the server value. Please check Shared Datacenter Proxies documentation; here, you’ll find the list of available countries.
If you’re using Dedicated Datacenter Proxies, insert your unique IP address in the host field and enter 60000 in the port field.
You’ll have to choose an IP address from the acquired list. Please refer to our documentation for more details.
For Self-Service Dedicated Datacenter Proxies, use the following Proxy IP:Port sequence:
ddc.oxylabs.io:8001
The port indicates the sequential number of an IP address from the acquired list. Check our documentation for more details.
And that's it! You've successfully integrated Oxylabs' proxies with Playwright.
In combination with Oxylabs' proxies, Playwright could be a great tool when it comes to browser automation and web scraping. Of course, we offer our own Web Scraper API to collect public data even more easily if you search for maintenance-free scraping infrastructure.
If you have any questions about integrating Oxylabs proxies, you can contact us at any time. You should also visit our GitHub profile for more integrations with Oxylabs proxies.
Please be aware that this is a third-party tool not owned or controlled by Oxylabs. Each third-party provider is responsible for its own software and services. Consequently, Oxylabs will have no liability or responsibility to you regarding those services. Please carefully review the third party's policies and practices and/or conduct due diligence before accessing or using third-party services.
Playwright vs Selenium: Which One to Choose
Let's discuss Playwright vs Selenium, their relevance to web scraping, and what to remember when picking one for your scraping task.
Playwright vs Puppeteer: The Differences
Find out how Playwright and Puppeteer stack up against each other in particular scenarios, including web scraping.
Web Scraping With Playwright Tutorial for 2023
This article explains everything about Playwright and how it can be used for automation and even web scraping.
Get the latest news from data gathering world
Get Playwright proxies for $10/GB
GET IN TOUCH
General:
hello@oxylabs.ioSupport:
support@oxylabs.ioCareer:
career@oxylabs.ioCertified data centers and upstream providers
Connect with us
Advanced proxy solutions
Resources
Innovation hub