Rayrun
← Back to Discord Forum

How to route project browsers via proxy pac URL or .pac file?

sagarsen0392posted in #help-playwright
Open in Discord
sagarsen0392

I am using playwright with javascript and for a project I need to proxy via a automatic configuration url or file. How do I do it ? Thank you in advance !!

This thread is trying to answer question "How to route project browsers via proxy pac URL or .pac file using Playwright with JavaScript?"

11 replies

Hi @sagarsen0392 are you able to use .pac or url in proxy?

@mxschmitt sorry for tagging you directly, kindly help. Our team is also blocked due to this. Normal proxy setting not working for few instances

.avocadojam
.avocadojam

Hello, were you guys able to figure it out? The closest thing I found to playwright using a pac file is this link https://github.com/microsoft/playwright-java/issues/1437 and https://github.com/microsoft/playwright/issues/14690\

.avocadojam
.avocadojam

Could not for the life of me find anything about a pac file in docs either. Maybe its a request that can be asked for

Can you not just extract the proxy config from the PAC file and configure the proxy manually? Or does your proxy require some specific handling that's not covered by general proxy config?

.avocadojam
.avocadojam

It requires some specific handling unfortunately. I actually manually configured it and it works for 95% of the cases. I know the pac file is needed because if I go into codegen and download proxy omega switchy and add the pac file. Everything works as intended.

.avocadojam
.avocadojam

I made a feature request for this, but they said it was niche. So probably going to spin up a local stack for backend so it connects properly 😅

AIUI, PAC files are just Javascript that do whatever they need to do, and then return the proxy config to use?

So you might just be able to call it from your Playwright config file, and parse whatever proxy output it returns, and feed that into Playwright's proxy config.

I've never used PAC files, so I might be way off... It just feels like this might work though...

.avocadojam
.avocadojam

Yes, they take in a url and depending on what it is, return a proxy. I would need to then change or not change playwright config depending on the url. Also this pac file I am using is a little funky haha. I think it would just be easier if PAC files were something we could do in playwright.

.avocadojam
.avocadojam

When I have some bandwidth I will try this approach

I assume that it's not commonly needed by many people using Playwright. But as I say, it's just JavaScript, so I feel like you ought to be able to call it, parse the output and configure Playwright proxy based on that. Let us know how you get on...

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

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].