What is Playwright?
The playwright is a web autotest (automation) framework which is provided by Microsoft. It is similar to Selenium.
We may use these web automation frameworks to scrape (extract) data from a website. Sometimes, we have to use a proxy to bypass blocking from a website. Below source code is use proxy for Playwright
1 2 3 4 5 6 7 8 9 10 11 |
with sync_playwright() as p: browser = p.webkit.launch(headless=False, proxy={ "server": 'server-address:port', 'username': 'My_user', "password": 'My_password', }) context = browser.newContext() page = context.newPage() page.goto('https://whoer.net') page.screenshot(path='whoer.png') browser.close() |
If you have any question, don’t hesitate to contact me
Good luck !
I am Tuan from Vietnam. I am a programmer Freelancer at web scraping, web automation, Python scripting. I have worked for 7+ years in these fields.