Skip to content

Instantly share code, notes, and snippets.

@iandanforth
Created December 10, 2015 21:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iandanforth/2600c1b442e5e67fa089 to your computer and use it in GitHub Desktop.
Save iandanforth/2600c1b442e5e67fa089 to your computer and use it in GitHub Desktop.
How do I enable remote debugger for python webdriver phantomjs?

I couldn't find this documented anywhere, but the option exists and lives in the code!

If you're using python, selenium, and phantomjs, somewhere in your code you have a line like this:

from selenium import webdriver
driver = webdriver.PhantomJS()

To enable remote debugging you need to know that PhantomJS() takes a 'service_args' argument. Change the second line as follows and you should be good to go.

driver = webdriver.PhantomJS(service_args=["--remote-debugger-port=9000"])

You can then follow along with the various tutorials on remote debugging for PhantomJS. I like this one:

https://drupalize.me/blog/201410/using-remote-debugger-casperjs-and-phantomjs

To learn about more hidden options for PhatomJS, read the code!

PhantomJS Class

Underylying Service Class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment