You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my setup I try to override "User-Agent" http header while using Firefox + HTTP Proxy
However I get NS_ERROR_PROXY_CONNECTION_REFUSED error.
Important notes:
I verified that my HTTP Proxy works fine
Commenting out part that is responsible for http header solves the issue
Switching to Chromium solves the issue
My script:
import asyncio
import logging
from playwright.async_api import ProxySettings, async_playwright
logging.basicConfig(level=logging.DEBUG)
async def main():
proxy: ProxySettings = {
"server": "<proxy host>",
"username": "< proxy username>",
"password": "<proxy password>",
}
async with async_playwright() as playwright, await playwright.firefox.launch(
headless=False,
) as browser:
context = await browser.new_context(proxy=proxy)
page = await context.new_page()
await page.route(
"**/*",
lambda route: route.continue_(
headers={
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/131.0",
}
),
)
await page.goto("https://bot.sannysoft.com/")
await page.wait_for_timeout(30000)
if __name__ == "__main__":
asyncio.run(main())
Instead of overriding the User-Agent like this, would our official API work for you?
context=awaitbrowser.new_context(proxy=proxy, user_agent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:131.0) Gecko/20100101 Firefox/131.0")
page=awaitcontext.new_page()
Version
1.48.0
Steps to reproduce
In my setup I try to override "User-Agent" http header while using Firefox + HTTP Proxy
However I get
NS_ERROR_PROXY_CONNECTION_REFUSED
error.Important notes:
My script:
Expected behavior
I expect web page to load
Actual behavior
Calling
page.goto()
throwsNS_ERROR_PROXY_CONNECTION_REFUSED
Additional context
No response
Environment
The text was updated successfully, but these errors were encountered: