- Mar 8, 2019
- 1,633
- 2,839
Hi, how do you open chrome with python selenium with a proxy?
I want to shift from the vpn plugin to proxies, cant work it out
I want to shift from the vpn plugin to proxies, cant work it out
Have you checked this? I think the issue is that you use auth, and Chrome doesn't support it.
Code:https://stackoverflow.com/questions/53082267/how-can-i-set-socks5-proxy-for-selenium-webdriver-python
This should work for selenium.options.add_argument("--proxy-server=socks5://127.0.0.1:1080")
const browser = await puppeteer.launch({
headless: true,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
`--proxy-server=${proxy}`
]
});
from selenium import webdriver
PROXY_HOST = 'proxy.example.com'
PROXY_PORT = '1234'
PROXY_USER = 'your_username'
PROXY_PASS = 'your_password'
prox = Proxy()
prox.proxy_type = ProxyType.MANUAL
prox.http_proxy = f"{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}:{PROXY_PORT}"
prox.ssl_proxy = f"{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}:{PROXY_PORT}"
capabilities = webdriver.DesiredCapabilities.CHROME
prox.add_to_capabilities(capabilities)
driver = webdriver.Chrome(desired_capabilities=capabilities)
Here's an example
Python:from selenium import webdriver PROXY_HOST = 'proxy.example.com' PROXY_PORT = '1234' PROXY_USER = 'your_username' PROXY_PASS = 'your_password' prox = Proxy() prox.proxy_type = ProxyType.MANUAL prox.http_proxy = f"{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}:{PROXY_PORT}" prox.ssl_proxy = f"{PROXY_USER}:{PROXY_PASS}@{PROXY_HOST}:{PROXY_PORT}" capabilities = webdriver.DesiredCapabilities.CHROME prox.add_to_capabilities(capabilities) driver = webdriver.Chrome(desired_capabilities=capabilities)
No offence but whats wrong with bumping old threads ???Not that I don't appreciate your shorthand Python, please stop bumping old threads.