0

I've written a script which opens Chromium and keeps it open for a set time, but I want to be able to set a proxy within the python script before opening Chromium. Is this possible? I've googled for some time, but I can't find how to do it.

Thanks in advance.

import os
from time import sleep
import webbrowser
import random
import time

timeDelay = random.randrange(57, 100)

def search():

  #new browser object
 chrome = webbrowser.get('chromium-browser')
  #search engine startpoint
 google = chrome.open_new("https://www.google.com")

if __name__ == "__main__":
 sleep(0.5)
 search()
 time.sleep(timeDelay)
user1721451
  • 247
  • 6
  • 15
  • See this question: https://stackoverflow.com/questions/11450158/how-do-i-set-proxy-for-chrome-in-python-webdriver – Deepak Garud Oct 11 '18 at 11:37
  • Thanks Deepak, so just so I can understand, use selenium to set the proxy, and this will work with actually opening the browser in the GUI (non command line)? – user1721451 Oct 11 '18 at 12:57
  • If you are referring to the browser opened by selenium, yes. Note that there are ways to use a proxy in process specific way (so proxy is used just by process and does not affect browsers opened later) and system wide way - i.e. when you set proxy in Internet explorer, it saves it in registry, so it affects all browsers opened later. – Deepak Garud Oct 11 '18 at 13:07
  • Thanks again, that's great. – user1721451 Oct 11 '18 at 13:50

0 Answers0