Using ProxyMesh (https://proxymesh.com ) IP in selenium chrome driver for web scrapping
Question: I have performed web-scrapping using python-scrapy framework with a Proxy Mesh
IP. If the proxy requires authentication I use the following code :

    
    
    import base64
    
    # Start your middleware class
    class ProxyMiddleware(object):
        # overwrite process request
        def process_request(self, request, spider):
            # Set the location of the proxy
            request.meta['proxy'] = "http://....."
    
            # Use the following lines if your proxy requires authentication
            proxy_user_pass = "username:pwd"
            # setup basic authentication for the proxy
            encoded_user_pass = base64.encodestring(proxy_user_pass)
            request.headers['Proxy-Authorization'] = 'Basic ' + encoded_user_pass
    

When I want to do the same while scraping using selenium chrome driver what is
the appropriate technique that can be used. I find examples using firefox but
no luck in chrome driver. Please share your ideas.


Answer: Going through documenation on [proxymesh how to configure http
client](https://proxymesh.com/http-client-examples/), you can set your profile
object as follow

    
    
    profile = webdriver.FirefoxProfile()
    profile.set_preference("network.proxy.type", 1)
    profile.set_preference("network.proxy.http", "http://username:password@xyz.proxymesh.com")
    profile.set_preference("network.proxy.http_port", "portnumber")
    profile.update_preferences()
    
    driver = webdriver.Firefox(firefox_profile=profile)
    

or you can use `webdriver.Proxy` object to set ssl credentials. Also there are
options available on proxymesh configuration panel where you can add your ip
address/hostname [of your server which is using proxymesh service].

