Using Selenium, PhantomJS and Tor in python Using Selenium, PhantomJS and Tor in python selenium selenium

Using Selenium, PhantomJS and Tor in python


This is an old one, but I came here, because I searched for exactly what you wanted to do.

When I executed your code, I got exactly the same behaviour.

Simply remove the blank space at second argument ('--proxy-type=socks5') and your code is working nicely.

Thus,

    from selenium import webdriver    service_args = [        '--proxy=127.0.0.1:9050',        '--proxy-type=socks5',    ]    driver = webdriver.PhantomJS(service_args = service_args)


Try adding your exact phantomjs path?

driver = webdriver.PhantomJS(executable_path=<your_phantomjs_path>, service_args = service_args)