I have been trying to use proxy with Python Selenium on CentOS server.
I have same code on Windows 10 working fine as well.
I have same version of everything, Python, Selenium and ChromeDriver on both OS.
Here is my code.
import os
from selenium import webdriver
from pyvirtualdisplay import Display
from selenium.webdriver.chrome.options import Options
display = Display(visible=0, size=(800, 600))
display.start()
chrome_options = Options()
chrome_options.add_argument('--proxy-server=%s' % "http://198.55.109.17:3128")
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
driver = webdriver.Chrome('/usr/local/bin/chromedriver', chrome_options=chrome_options)
driver.get("https://api.ipify.org?format=json")
print driver.page_source.encode('utf-8')
driver.quit()
display.stop()
Proxy is not changed at all, it just shows my own server's IP instead of the proxy's IP I am using