Прокси Python Selenium Gekodriver не применяется - PullRequest
0 голосов
/ 08 ноября 2019

Я пытаюсь применить HTTP-прокси с аутентификацией к экземпляру веб-драйвера Selenium с помощью geckodriver:

proxy_options = Proxy({
            'proxyType': ProxyType.MANUAL,
            'httpProxy': f"{self.sender['proxy_ip']}:{self.sender['proxy_port']}",
            'socks_username': self.sender['proxy_username'],
            'socks_password': self.sender['proxy_password']
        })

        profile = webdriver.FirefoxProfile()
        profile.set_preference("network.proxy.type", 1)
        profile.set_preference("network.proxy.http", self.sender['proxy_ip'])
        profile.set_preference("network.proxy.http_port", self.sender['proxy_port'])
        profile.set_preference("network.proxy.socks_username", self.sender['proxy_username'])
        profile.set_preference("network.proxy.socks_password", self.sender['proxy_password'])
        profile.update_preferences()
        self.browser = webdriver.Firefox(executable_path=GECKO_PATH, options=BROWSER_OPTS, proxy=proxy_options,
                                         firefox_profile=profile)

Я пробовал использовать как параметр прокси, так и параметр профиля. Браузер перемещается по URL-адресу без применения прокси.

...