Joern Boegeholz
Joern Boegeholz

Reputation: 591

Disable proxy via Python for Selenium with headless Chrome

I'm using Chrome with Selenium in Python 2.7.

I've tried to run Chrome in headless mode but it slows down my tests significantly.

One workaround shall be to disable the proxy settings but I don't know how to do it in python.

This is my code so far:

from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument('headless')
chrome_options.add_argument('--hide-scrollbars')
chrome_options.add_argument('--disable-gpu')
chrome_options.add_argument('???') # which option?
self.driver = webdriver.Chrome("C:\Python27\Scripts\chromedriver.exe", chrome_options=chrome_options)

Does anyone know how to solve this?

Upvotes: 4

Views: 9449

Answers (1)

Alexey Dolgopolov
Alexey Dolgopolov

Reputation: 700

Try this:

chrome_options.add_argument('--no-proxy-server')

Upvotes: 10

Related Questions