title: automation testing by selenium
body: <p>i have too many usernames and passwords in a txt file and i want to use  them in a test script , the password many contain (:) and  the error is (ValueError: too many values to unpack (expected 2)) how to fix this and how to get the data from the txt file and use them in the test .</p>
  
  <p>the txt look like this </p>
  
  <pre><code>user1:pass1
  user2:pass2
  user3:password
  username5:password6
  testit:passtest
  </code></pre>
  
  <p>etc </p>
  
  <p>i tried many codes to read the txt file and use it to login no luck .</p>
  
  <p>login do some tasks and logout and repeat the process with  the rest accounts </p>
  
  <pre><code>from selenium import webdriver
      from time import sleep
      from getpass import getpass
      import time
  
  #login username &amp; password
  
  with open('accounts.txt', 'r') as file:
      for line in file:
          user, password = line.split(':')
  
  
  #define what browser &amp; website
  browser = webdriver.Firefox()
  browser.get(('https://example.com'))
  elem = browser.find_element_by_xpath("//*[@id='loginRegisterTabs']/ul/li[1]")
  elem.click()
  
  emailelement = browser.find_element_by_xpath("//*[@id='loginForm']/div[1]/div/input")
  emailelement.send_keys('user')
  passelement = browser.find_element_by_xpath("//*[@id='loginForm']/div[2]/div/input")
  passelement.send_keys('password')
  elem = browser.find_element_by_xpath("//*[@id='loginForm']/p/button[1]/span")
  elem.click()
  
  #server login
  time.sleep(1)
  elem = browser.find_element_by_xpath("//*[@id='joinGame']/button/span[1]")
  elem.click()
  
  #Active Daily
  time.sleep(1)
  elem = browser.find_element_by_xpath("//*[@id='multiPopup']/div[2]/div[2]/a")
  elem.click()
  
  
  #menu
  time.sleep(4)
  browser.switch_to.window(browser.window_handles[1])
  elem = browser.find_element_by_xpath("//*//*[@id='GF_toolbar']/ul/li[5]/a")
  elem.click()
  
  #Vmod Menu
  time.sleep(2)
  elem = browser.find_element_by_xpath("//*[@id='vacationMode']/div[1]/div/a")
  elem.click()
  
  #Active Vmod
  time.sleep(2)
  elem = browser.find_element_by_xpath("//*[@id='options_umod_confirm']/div[2]/div[2]/div[2]/div[1]/div[1]/a")
  elem.click()
  </code></pre>