Selenium chrome驱动程序socks代理配置

Selenium chrome驱动程序socks代理配置,selenium,configuration,proxy,socks,selenium-chromedriver,Selenium,Configuration,Proxy,Socks,Selenium Chromedriver,我在为chrome驱动程序设置socks代理时遇到问题 Proxy proxy = new Proxy(); proxy.setProxyType(Proxy.ProxyType.MANUAL); proxy.setAutodetect(false); proxy.setSocksProxy(ProxyHelper.PROXY_HOST + ":" + ProxyHelper.PROXY_PORT); DesiredCapabilities capabilities = DesiredCapab

我在为chrome驱动程序设置socks代理时遇到问题

Proxy proxy = new Proxy();
proxy.setProxyType(Proxy.ProxyType.MANUAL);
proxy.setAutodetect(false);
proxy.setSocksProxy(ProxyHelper.PROXY_HOST + ":" + ProxyHelper.PROXY_PORT);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.PROXY, proxy);
WebDriver chromeDriver = new ChromeDriver(capabilities);
此配置提供:

Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot parse capability: proxy from unknown error: proxyType is 'manual' but no manual proxy capabilities were found
我想它希望我填写http、ftp和ssl代理。但如果我填满它们;错误不会出现,但我的代理也不能正常工作,因为它试图像http代理一样使用它,而不是socks代理


我能做什么?

你试过使用这个铬精氨酸吗

--proxy-server="socks5://host:port"

您是如何修复此错误的?@JobaDiniz请查看以下答案:
    ChromeOptions options = new ChromeOptions();
    options.add_argument("--proxy-server=socks5://" + host + ":" + port);
    WebDriver driver = new ChromeDriver(options);
from selenium.webdriver.firefox.options import Options as ff_options
random_proxy = "142.54.61.98:120"
options = ff_options()
firefox_capabilities = webdriver.DesiredCapabilities.FIREFOX
firefox_capabilities['marionette'] = True
firefox_capabilities['proxy'] = {
    "proxyType": "MANUAL",
    "httpProxy": random_proxy,
    "ftpProxy": random_proxy,
    "sslProxy": random_proxy
}
profile = webdriver.FirefoxProfile()
profile.set_preference("media.peerconnection.enabled", False)
profile.set_preference("media.navigator.enabled", False)
# profile.set_preference("general.useragent.override", user_agent)
profile.update_preferences()

driver = webdriver.Firefox(capabilities=firefox_capabilities, firefox_profile=profile,
                           firefox_options=options)