Home » Uncategorized » firforx https 代理 selenium

firforx https 代理 selenium

 

ip = “127.0.0.1” duankou = int(123456)#这里记得类型转换,这坑踩了2天

profile = webdriver.FirefoxProfile()

profile.set_preference(‘network.proxy.type’,1)

profile.set_preference(‘network.proxy.http’,”%s”%ip)

profile.set_preference(‘network.proxy.http_port’,duankou)

profile.set_preference(‘network.proxy.ssl’,”%s”%ip)

profile.set_preference(‘network.proxy.ssl_port’,duankou) #profile.set_preference(‘general.useragent.override’,uap)#设置代理头

profile.update_preferences()

driver = webdriver.Firefox(firefox_profile=profile,executable_path=os.getcwd()+’/driver/geckodriver.exe’)