Playwright
Integrate Playwright with Oxylabs Proxies for browser automation – a Node.js setup guide with code examples.
Playwright is a Node.js library that lets you script and automate browsers using the same API, like Chrome, Firefox, and Safari. It is a convenient framework for automation and testing purposes.
Watch our video guide or follow the steps below to integrate Playwright with the following Oxylabs proxies:
Step 1
Install Node.js and a code editor of your choice. (Skip this step If you already have it)
Step 2
Create a Node.js project and install the required packages.
Step 3
Within your Playwright script, fill in the 'proxy' values as shown below:
Enter your server value according to your chosen Oxylabs proxy type:
Residential & Mobile Proxies
Protocol: http, https, or socks5h
Host: pr.oxylabs.io
Port: 7777
Username: customer-USERNAME
Password: PASSWORD
Note: Don't forget to add customer- prefix to your username.
You may also use additional parameters with residential and mobile proxies to set the geo-location (country, state, city, and etc.) and control sessions. Check out the Residential Proxies documentation to learn more.
Datacenter Proxies
Protocol: http, https, or socks5h
Host: dc.oxylabs.io
Port: 8001
Username: user-username
Password: password
Note: Don't forget to add user- prefix to your username.
Pay-per-IP subscription
The port is the sequential number assigned to an IP address from the proxy list. Thus, port 8001 uses the first IP address from your list. You may also enable proxy IP rotation by setting the port to 8000.
Furthermore, you can specify the geo-location, for example, the US, by setting the Proxy username to user-USERNAME-country-US.
Pay-per-traffic subscription
The port 8001 picks a random IP address but stays consistent during a session. Alternatively, you can rotate proxy IPs with each request by using port 8000.
If you want to use a specific geo-location, for example, the US, set the Proxy username to user-USERNAME-country-US.
Dedicated Datacenter Proxies (Enterprise)
Protocol: http, or socks5h
Host: 1.2.3.4 (IP address from your proxy list)
Port: 60000 (HTTP), 1180 (SOCKS5)
Username: username
Password: password
For Enterprise Dedicated Datacenter Proxies (purchased through sales team), you’ll have to choose an IP address from the acquired proxy list.
Dedicated Datacenter Proxies (Self-service)
Protocol: http, https, or socks5h
Host: ddc.oxylabs.io
Port: 8001
Username: user-username
Password: password
Note: Don't forget to add user- prefix to your username.
For Self-Service Dedicated Datacenter Proxies (purchased through Oxylabs dashboard), the port indicates the sequential number of an IP address from the acquired proxy list. If you want to get a different IP with each request, change the Port to 8000 to enable proxy rotation.
ISP Proxies
Protocol: http, https, or socks5h
Host: isp.oxylabs.io
Port: 8001
Username: user-username
Password: password
Note: Don't forget to add user- prefix to your username.
With ISP Proxies, the port is assigned to a specific IP address and its location. Hence, port 8001 will always pick the first IP from your proxy list. If you want to get a different IP with each request, change the Port to 8000 to enable proxy rotation.
Dedicated ISP Proxies
Protocol: http, https, or socks5h
Host: disp.oxylabs.io
Port: 8001
Username: user-username
Password: password
Note: Don't forget to add user- prefix to your username.
You will need to choose the port assigned to an IP address from the purchased proxy list, which you can find on the Oxylabs dashboard. The 8001 port will pick the first IP address from your list for all requests. Use port 8000 for automatic proxy IP rotation.
Full code sample
And that's it! You've successfully integrated Oxylabs proxies with Playwright. If you want to learn more about web scraping with Playwright, read our blog post.
Find the original Playwright integration blog post here.
Last updated
Was this helpful?

