from playwright.sync_api import Playwright, sync_playwright with sync_playwright() as playwright: browser = playwright.chromium.launch() proxy_server = 'http://my-proxy-server.com:8080' context = browser.new_context(proxy={ 'server': proxy_server, 'username': 'my-username', # 如果需要身份验证,可以通过这里指定用户名和密码 'password': 'my-password' }) page = context.new_page() page.goto('http://example.com') browser.close()
标签:playwright,context,python,sync,server,proxy,版本,my From: https://www.cnblogs.com/angdh/p/17505344.html