(webdriver.DesiredCapabilities.PHANTOMJS['phantomjs.page.settings.userAgent']
    ) = (
    """Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36"""
    )
driver = webdriver.PhantomJS(*args, **kwargs)
driver.set_window_size(1400, 1000)
return driver

def main():
    service_args = ['--proxy=127.0.0.1:9999', '--proxy-type=http',
        '--ignore-ssl-errors=true']
driver = init_phantomjs_driver(service_args=service_args)
driver.get('http://cn.bing.com')
Selenium PhantomJS custom headers in Python