Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/360.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何打开Firefox的远程DNS功能';通过Selenium(Python)设置代理服务器?_Python_Firefox_Selenium_Selenium Webdriver - Fatal编程技术网

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

如何打开Firefox的远程DNS功能';通过Selenium(Python)设置代理服务器?,python,firefox,selenium,selenium-webdriver,Python,Firefox,Selenium,Selenium Webdriver,我正在编写一个程序,它由一个浏览器(Firefox)组成,该浏览器已设置为使用代理,用于打开网站和链接 以下是我源代码的一部分: from selenium import webdriver def my_proxy(PROXY_HOST,PROXY_PORT): fp = webdriver.FirefoxProfile() print PROXY_PORT print PROXY_HOST fp.set_preference(

我正在编写一个程序,它由一个浏览器(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功能?

将设置为
True

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

非常感谢。你是从哪里找到这个偏好的?@潜水员基本上只是打开了“about:config”并搜索了“dns”。然后在线重新检查偏好。