Advertisement
dereksir

Untitled

Aug 31st, 2023 (edited)
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { chromium } = require('playwright-extra')
  2.  
  3. // Configure and add the proxy router plugin with a default proxy
  4. const ProxyRouter = require('@extra/proxy-router')
  5. chromium.use(
  6.   ProxyRouter({
  7.     proxies: { DEFAULT: 'http://user:pass@proxyhost:port' },
  8.   })
  9. )
  10.  
  11. (async () => {
  12.   const browser = await chromium.launch({ headless: true });
  13.  
  14.   const page = await browser.newPage();
  15.   await page.goto('http://httpbin.io/ip');
  16.  
  17.   // Get the text content of the page
  18.   const textContent = await page.evaluate(() => document.body.textContent);
  19.  
  20.   console.log('IP:');
  21.   console.log(textContent);
  22.  
  23.   await browser.close();
  24. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement