0

I'd like to use headless mode with proxy auth login:pass in my python script. I use chrome here.

I have tried creating extension and adding it to chrome, but it works only without headless mode. I was looking for similar issues, but there's no solution like it was unsupoorted. Can anybody give me any tips?

1

2 Answers 2

0

Regular headless mode doesn't support extensions, however, Chrome added a newer headless mode that does. Here's how to set it with Selenium options:

options.add_argument("--headless=new")

More info: https://github.com/chromium/chromium/commit/e9c516118e2e1923757ecb13e6d9fff36775d1f4

This assumes you are already using https://stackoverflow.com/a/35293284/7058266 for creating a Chrome extension to set proxy with auth. You may want to see how to set proxy with authentication in selenium chromedriver python? for other ways of setting a proxy.

Sign up to request clarification or add additional context in comments.

Comments

0

To add to that, you probably want to use Manifest V3 in your extension. I had used Manifest V2 in mine and it was causing issues with newer Chrome versions. Essentially, the extension would not get loaded properly and would cause a timeout error when trying to load generated background page.html.

To add to that, it was working fine in my development environment, which was running on an older Chrome version than production (not ideal, I know). Needless to say, that it took me a while to figure out the root cause.

With Manifest V3 and the options.add_argument("--headless=new") setting mentioned previously, my extension for proxy authentication is now running absolutely fine in Selenium with headless Chrome.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.