Skip to content

Instantly share code, notes, and snippets.

@brizzbane
Last active August 29, 2015 14:12
Show Gist options
  • Save brizzbane/5d275c46122cfa53cb8c to your computer and use it in GitHub Desktop.
Save brizzbane/5d275c46122cfa53cb8c to your computer and use it in GitHub Desktop.
phantomjs/ghostdriver session test
from selenium import webdriver
proxylist = ['127.0.0.1','127.0.0.2']
a = {}
for proxy in proxylist:
a[proxy] = webdriver.PhantomJS(executable_path='C:\Python27\selenium\phantomjs.exe',service_args=['--proxy=' + proxy + ':3128', '--proxy-type=http'])
a[proxy].set_window_size(1120, 550)
a[proxy].get("http://whatismyipaddress.com")
a[proxy].save_screenshot(proxy + '.png') #will always end up displaying 127.0.0.1 in screenshot, while creating both 127.0.0.1.png, and 127.0.0.2.png
print a[proxy].current_url
a[proxy].quit()
print a[proxy]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment