title: Iterate over a proxy list selenium python
body: <p>I am making a twitter <strong>scraper</strong> that <strong>scrapes</strong> the recovery info of twitter accounts
  The thing is that i need to change proxys every 4 iterations
  what i've came up with:</p>
  <pre><code>     from selenium import webdriver
  from selenium.webdriver.common.by import By
  from selenium.webdriver.support.ui import WebDriverWait
  from selenium.webdriver.support import expected_conditions as EC
  import smtplib
  import time
  import sys
  import os
  
  #puts all the links into a username
  with open('list.txt', 'r') as f:
      users = [line.strip() for line in f]
  #where results are stored
  result = open(r&quot;results.txt&quot;,&quot;w&quot;)
  #stores the proxys
  with open('proxy.txt', 'r') as f:
      proxies = [line.strip() for line in f]
  counter = 0
  for user in users:
          
      #adding proxy
      chrome_options = webdriver.ChromeOptions()
      chrome_options.add_argument('--proxy-server=http://%s' % proxies[counter])      #iniatialization of the driver
      browser = webdriver.Chrome(chrome_options=chrome_options)
      counter=counter+1
      #stage 1 username was entered and submitted
      url = 'https://twitter.com/account/begin_password_reset'
      browser.get(url)
      textbox = browser.find_element_by_xpath('/html/body/div[2]/div/form/input[2]')
      textbox.send_keys(user)
      submit_button = browser.find_element_by_xpath('/html/body/div[2]/div/form/input[3]')
      submit_button.click()
      validator= browser.find_element_by_xpath('/html/body/div[2]/div/form/input[2]')
      validator2=browser.find_element_by_xpath('/html/body/div[2]/div/a')
      if not validator or not validator2:
          
          name = browser.find_element_by_xpath(&quot;/html/body/div[2]/div/div[2]/div/div[1]&quot;).text
          email= browser.find_element_by_xpath(&quot;/html/body/div[2]/div/form/ul/li/label/strong&quot;).text
          result.write(user+ &quot;:&quot;+ name+&quot;:&quot;+email) 
   
  </code></pre>
  <p>the problem i am facing is that the proxies are not iterating and some proxies are dead so its stopping the whole program.</p>