I am trying to use proxpy to monitor any requests made during the python-selenium test. The Python code I use is as follows:
from selenium import webdriver
PROXY = "0.0.0.0:9999"
webdriver.DesiredCapabilities.FIREFOX['proxy'] = {
"httpProxy":PROXY,
"ftpProxy":PROXY,
"sslProxy":PROXY,
"proxyType":"MANUAL"
}
driver = webdriver.Firefox()
driver.get("http://www.google.co.in")
driver.quit()
and I start the proxy as follows:
python proxpy/proxpy/proxpy.py -p 9999
When I run the python script test, I get the following error:
Exception happened during processing of request from ('127.0.0.1', 64667)
Traceback (most recent call last):
File "/Users/adietz/anaconda/lib/python2.7/SocketServer.py", line 596, in process_request_thread
self.finish_request(request, client_address)
File "/Users/adietz/anaconda/lib/python2.7/SocketServer.py", line 331, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Users/adietz/Projects/Invest/browsermob/proxpy/proxpy/core.py", line 56, in __init__
SocketServer.StreamRequestHandler.__init__(self, request, client_address, server)
File "/Users/adietz/anaconda/lib/python2.7/SocketServer.py", line 652, in __init__
self.handle()
File "/Users/adietz/Projects/Invest/browsermob/proxpy/proxpy/core.py", line 137, in handle
res = self.doCONNECT(host, port, req)
File "/Users/adietz/Projects/Invest/browsermob/proxpy/proxpy/core.py", line 188, in doCONNECT
ssl_version = ssl.PROTOCOL_SSLv23, do_handshake_on_connect = False)
File "/Users/adietz/anaconda/lib/python2.7/ssl.py", line 933, in wrap_socket
ciphers=ciphers)
File "/Users/adietz/anaconda/lib/python2.7/ssl.py", line 544, in __init__
self._context.load_cert_chain(certfile, keyfile)
IOError: [Errno 2] No such file or directory
How can i fix this? How can I avoid this error? How can I just keep track of requests and responses ...?
On a Linux machine, the error is equivalent to:
Exception happened during processing of request from ('127.0.0.1', 35348)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 596, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/home/adietz/Projects/Invest/browsermob-proxy/proxpy/proxpy/core.py", line 56, in __init__
SocketServer.StreamRequestHandler.__init__(self, request, client_address, server)
File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__
self.handle()
File "/home/adietz/Projects/Invest/browsermob-proxy/proxpy/proxpy/core.py", line 137, in handle
res = self.doCONNECT(host, port, req)
File "/home/adietz/Projects/Invest/browsermob-proxy/proxpy/proxpy/core.py", line 188, in doCONNECT
ssl_version = ssl.PROTOCOL_SSLv23, do_handshake_on_connect = False)
File "/usr/lib/python2.7/ssl.py", line 933, in wrap_socket
ciphers=ciphers)
File "/usr/lib/python2.7/ssl.py", line 544, in __init__
self._context.load_cert_chain(certfile, keyfile)
IOError: [Errno 2] No such file or directory