title: Python / Selenium : paste faster in browser
body: <p>I have written a script in python to extract and paste 400-500 lines of text from one browser to another. I am using <code>send_keys()</code> to put the text content into the text area. It is writing line by line (2 lines / second) which is resulting in a few minutes to complete the operation. Is there any other method in Selenium to write faster (like how we paste manually in 1 second)?</p>
  
  <p>My code</p>
  
  <pre><code>&lt;code&gt;
  
  import time
  import re
  import csv
  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
  from selenium.common.exceptions import TimeoutException
  from selenium.common.exceptions import ElementNotVisibleException
  from selenium.webdriver.common.keys import Keys
  
  def init_driver(uname,pwd):
      driver = webdriver.Chrome()
      driver.wait = WebDriverWait(driver, 5)
      driver.get("https://ops.stg1.xxxxxyyyxxxx.com/login.jsp")
      box = driver.wait.until(EC.presence_of_element_located((By.NAME, "j_username")))
      box.send_keys(uname)
      box = driver.wait.until(EC.presence_of_element_located((By.NAME, "j_password")))
      box.send_keys(pwd)
      button = driver.wait.until(EC.element_to_be_clickable((By.NAME, "login")))
      button.click()
      return driver
  
  def copy():
      with open("Tag_input.txt") as f:
          for line in f:
              url = line.strip()  
              driver.get(url)
      k=re.findall('\=(\d+)',url)
      print(k[0])
      a=k[0]
      driver.wait = WebDriverWait(driver, 10)
      time.sleep(10)
      PC = driver.find_elements_by_xpath("//textarea[@name='messagingMap.PRIMARY_CONTENT.message']")
      PC.send_keys(Keys.CONTROL, "a")
      PC.send_keys(Keys.CONTROL, "c")
      print("Copied Primary content !!")
      for tag in PC:
          varPC = tag.text
          url1 = "http://jona.ca/blog/unclosed-tag-finder"
          driver.get(url1)
          driver.wait = WebDriverWait(driver, 10)
          time.sleep(10)
  
          text_area = driver.find_element_by_id("unclosed-tag-finder-input")
          text_area.send_keys(Keys.CONTROL, "v")
          button = driver.find_element_by_xpath("//input[@value='Submit']")
          button.click()
  
          result = driver.find_element_by_xpath("//pre[@id='unclosed-tag-finder-results']")
          res_list = list(result)
          print(res_list)
          op = result.text
          print(op)
  
          writer = csv.writer(open('Tag_OP.csv','a+'))
          z = zip(k,result)
          print(z)
          writer.writerows(k)
          writer.writerows(result)
          k = k.pop()
          print("List cleared",k[0])          
      driver.wait = WebDriverWait(driver, 10)
      time.sleep(10)
      return driver
  
  if __name__ == "__main__":
      driver = init_driver("abdul.salam@xxxyyxxx.com","xxyyxx")
      copy()
      time.sleep(25)
      driver.quit()
  
  &lt;/code&gt;
  </code></pre>