selenium:httplib.BadStatusLine异常

网上的解决办法: 

一、 

from selenium import webdriver
profile = webdriver.FirefoxProfile()
profile.set_preference('network.proxy.type', 1)
profile.set_preference('network.proxy.http', 'proxy_url')
profile.set_preference('network.proxy.http_port', 3128)
profile.set_preference('network.proxy.ssl', 'proxy_url')
profile.set_preference('network.proxy.ssl_port', 3128)
profile.update_preferences()
driver = webdriver.Firefox(profile)

二、

myProxy = "http://149.215.113.110:70"
proxy = Proxy({
    'proxyType': ProxyType.MANUAL,
    'httpProxy': myProxy,
    'ftpProxy': myProxy,
    'sslProxy': myProxy,
    'noProxy':''
})
self.driver = webdriver.Firefox(proxy=proxy)

三、

PROXY = "149.215.113.110:70"
webdriver.DesiredCapabilities.FIREFOX['proxy'] = {
    "httpProxy":PROXY,
    "ftpProxy":PROXY,
    "sslProxy":PROXY,
    "noProxy":None,
    "proxyType":"MANUAL",
    "class":"org.openqa.selenium.Proxy",
    "autodetect":False
}
# you have to use remote, otherwise you'll have to code it yourself in python to 
driver = webdriver.Remote("http://localhost:4444/wd/hub", webdriver.DesiredCapabilities.FIREFOX)

四、

profile = webdriver.FirefoxProfile()
profile.set_preference("network.proxy.type", 1)
profile.set_preference("network.proxy.http", "proxy.server.address")
profile.set_preference("network.proxy.http_port", "port_number")
profile.update_preferences()
driver = webdriver.Firefox(firefox_profile=profile)

==================================================== 

但是,以上方法都不能解决,升级selenium包也不行 
最后发现: 
只要开启了Fiddle-------不管有没有proxy settings,都能成功打开网页 
只要不开启-------------- 无论怎么设置proxy也会 raise BadStatusLine(line) 
同样的问题:
http://sqa.stackexchange.com/questions/1559/unable-to-run-standalone-test-script-in-selenium-with-python  

selenium:httplib.BadStatusLine异常_第1张图片

selenium:httplib.BadStatusLine异常_第2张图片

selenium:httplib.BadStatusLine异常_第3张图片


你可能感兴趣的:(selenium:httplib.BadStatusLine异常)