AutomatedTester / browsermob-proxy-py

A python wrapper for Browsermob Proxy
http://oss.theautomatedtester.co.uk/browsermob-proxy-py
236 stars 104 forks source link

Clafirication on prerequisites #31

Closed chiedo closed 9 years ago

chiedo commented 9 years ago

Here you go!

chiedo commented 9 years ago

Any updates on this?

chiedo commented 9 years ago

I tried both the full path and relative path.

AutomatedTester commented 9 years ago

can you raise a bug, with a reduced test case, so that I can try recreate the issue. Not sure what is special in your setup to warrant this.

On Mon, Mar 16, 2015 at 1:40 PM, Chiedo John notifications@github.com wrote:

I tried both the full path and relative path.

— Reply to this email directly or view it on GitHub https://github.com/AutomatedTester/browsermob-proxy-py/pull/31#issuecomment-81668715 .

chiedo commented 9 years ago

Hey man! Here is the error

File "run.py", line 61, in <module>
    server.start()
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/browsermobproxy/server.py", line 63, in start
    raise Exception("Can't connect to Browsermob-Proxy")

I am running the following from https://github.com/chiedojohn/python-selenium-starter/tree/b30fb35b9b3dd8fa2dbe31cbf26286791e152a98

python run.py --proxy

No big deal if you can't figure it out though as the workaround I have been using is only a minor inconvenience.

AutomatedTester commented 9 years ago

I can't get your version of bmp to start up but I made a small change

diff --git a/run.py b/run.py
index 051b54b..bf13cf4 100644
--- a/run.py
+++ b/run.py
@@ -57,7 +57,9 @@ else:
 # Set up the browsermob proxy if the argument is passed
 if(args.proxy):
     from browsermobproxy import Server
-    server = Server("browsermob-proxy/bin/browsermob-proxy")
+    path_to_bmp = os.path.abspath(os.path.join(os.path.dirname(__file__),
"browsermob-proxy/bin"))
+    server = Server("%s/browsermob-proxy" % path_to_bmp)
     server.start()
     proxy = server.create_proxy()

The error I was getting is

dburns in /private/tmp/python-selenium-starter/browsermob-proxy/bin on
master ● λ ./browsermob-proxy
Exception in thread "main" java.lang.NoClassDefFoundError:
net/lightbody/bmp/proxy/Main
Caused by: java.lang.ClassNotFoundException: net.lightbody.bmp.proxy.Main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

David Burns Email: david.burns@theautomatedtester.co.uk URL: http://www.theautomatedtester.co.uk/

On Thu, Mar 19, 2015 at 11:28 AM, Chiedo John notifications@github.com wrote:

Hey man! Here is the error

File "run.py", line 61, in server.start() File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/browsermobproxy/server.py", line 63, in start raise Exception("Can't connect to Browsermob-Proxy")

I am running the following from https://github.com/chiedojohn/python-selenium-starter/tree/b30fb35b9b3dd8fa2dbe31cbf26286791e152a98

python run.py --proxy

No big deal if you can't figure it out though as the workaround I have been using is only a minor inconvenience.

— Reply to this email directly or view it on GitHub https://github.com/AutomatedTester/browsermob-proxy-py/pull/31#issuecomment-83518406 .

chiedo commented 9 years ago

Thanks David, I went ahead and just re-downloaded browsermob proxy and that did the trick. It may have needed the jar files present.

AutomatedTester commented 9 years ago

awesome! glad it was that simple to solve ;)

David Burns Email: david.burns@theautomatedtester.co.uk URL: http://www.theautomatedtester.co.uk/

On Thu, Mar 19, 2015 at 3:02 PM, Chiedo John notifications@github.com wrote:

Thanks David, I went ahead and just re-downloaded browsermob proxy and that did the trick. It may have needed the jar files present.

— Reply to this email directly or view it on GitHub https://github.com/AutomatedTester/browsermob-proxy-py/pull/31#issuecomment-83616822 .

chiedo commented 9 years ago

Today I bow my head in shame. LOL