Showing posts with label usig proxy in selenium. Show all posts
Showing posts with label usig proxy in selenium. Show all posts

7. Using Proxy in Selenium Example

Hi  friends this is a perfect example of scrapy with proxy. Here  are four proxy which We are using alternatively.

from selenium import webdriver
import random
import time
from selenium.webdriver.common.proxy import *

while True:
    proxy = ['123.129.240.173:8081','201.63.184.41:3128','58.1.251.57:80','121.192.190.101:9999']
    myProxy = "http://"+proxy[random.randint(0,3)]
    print myProxy

    proxy = Proxy({
    'proxyType': 'MANUAL',
    'httpProxy': myProxy
  
    })

    driver = webdriver.Firefox(proxy=proxy)
    driver.implicitly_wait(30)
    driver.get("http://autopython.blogspot.in")
    time.sleep(5)
    driver.close()