如何通过 Selenium(Python) 打开 Firefox 代理设置的远程 DNS 功能?

How do i turn on the Remote DNS feature of Firefox's proxy settings via Selenium(Python)?

我正在编写一个程序,其中包含一个已设置为使用代理的浏览器 (Firefox),用于打开网站和链接。

这是我的部分源代码:

from selenium import webdriver

def my_proxy(PROXY_HOST,PROXY_PORT):
        fp = webdriver.FirefoxProfile()
        print PROXY_PORT
        print PROXY_HOST
        fp.set_preference("network.proxy.type", 1)
        fp.set_preference("network.proxy.socks",PROXY_HOST)
        fp.set_preference("network.proxy.socks_port",int(PROXY_PORT))
        fp.set_preference("general.useragent.override","whatever_useragent")
        fp.update_preferences()
        return webdriver.Firefox(firefox_profile=fp

如何打开 远程 DNS 功能?

network.proxy.socks_remote_dns 设置为 True:

fp.set_preference("network.proxy.socks_remote_dns", True)