Hey i wanted to try to add a proxy but when i use the following example from the docs: ############################## browser = chromium.launch(proxy={ "server": "http://myproxy.xx:3128", "username": "", "password": "" }) ############################## it gives me the following error: ERROR test_example.py - NameError: name 'chromium' is not defined
Ubuntu 22.04.3 LTS Do i miss something or is it not working in ubuntu?
This thread is trying to answer question "How can I set a proxy when using Ubuntu?"
Hi, the error is not related to proxies at all. Something related to the basics is not in working order yet.
It looks like the example is just a snippet, and not a complete working script. Take a look at some of the examples here: https://playwright.dev/python/docs/library
Hi thx for the reply @refactoreric , i used this snipped within a working example which opened a page.
anyway i got the proxy working with the following code: ################### from playwright.sync_api import sync_playwright
def run(playwright): chromium = playwright.chromium browser = chromium.launch(headless=False, proxy={"server": "socks5://127.0.0.1:4444"}) page = context.new_page() page.goto("https://www.google.com) page.pause();
with sync_playwright() as playwright: run(playwright) ####################
Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].