I'm trying to learn how to run a selenium webdriver with a proxy server, but directly following the documentation with the provided code:
from selenium import webdriver
PROXY = "<HOST:PORT>"
webdriver.DesiredCapabilities.FIREFOX['proxy'] = {
"httpProxy": PROXY,
"ftpProxy": PROXY,
"sslProxy": PROXY,
"proxyType": "MANUAL",
}
with webdriver.Firefox() as driver:
driver.get("https://selenium.dev")
yields the following error:
selenium.common.exceptions.InvalidArgumentException: Message: Invalid proxyType value: MANUAL
Is the documentation outdated or is there something else I'm not taking into account here?
The documentation in question can be found here
By changing the value from MANUAL
to manual
you can get rid of below exception
Message: Invalid proxyType value: MANUAL
And if you get below exception then remove this line "ftpProxy": PROXY,
.
Message: SessionNotCreatedError: InvalidArgumentError: Since Firefox 90 'ftpProxy' is no longer supported
Refer code below:
from selenium import webdriver
PROXY = "<HOST:PORT>"
webdriver.DesiredCapabilities.FIREFOX['proxy'] = {
"httpProxy": PROXY,
"sslProxy": PROXY,
"proxyType": "manual",
}
with webdriver.Firefox() as driver:
driver.get("https://selenium.dev")