title: How to fill in a phone number field in a form using Python
body: <p>The task is to automatically fill out the application form below using Python.</p>
  <p><a href="https://i.stack.imgur.com/dBKkC.png" rel="nofollow noreferrer">enter image description here</a></p>
  <p>I just can't figure out how to fill out the form to enter the phone number. Last name, first name and mail are randomly filled from the txt file. TIN is randomly generated in the required range. We need to help solve the problem with filling in the phone number from the txt file.</p>
  <p>Below is my code:</p>
  <pre><code>import time
  import random
  from selenium import webdriver
  
  
  browser = webdriver.Firefox(executable_path = 'C:\Program Files\geckodriver-v0.30.0\geckodriver.exe')
  browser.get(&quot;http://nrpgov.ru/&quot;)
  
  xpath = '/html/body/form/div[4]/div/div/div/div[4]/div[1]/div[2]/a'
  browser.find_element_by_xpath(xpath).click()
  
  surname_xpath = '/html/body/form/div[7]/div/div/div[2]/div/div/table/tbody/tr[1]/td/table/tbody/tr/td[2]/table/tbody/tr[1]/td/table/tbody/tr/td/input'
  lastname = open('surnames.txt', encoding='utf-8').readlines()
  browser.find_element_by_xpath(surname_xpath).send_keys(random.choice(lastname))
  
  name_xpath = '/html/body/form/div[7]/div/div/div[2]/div/div/table/tbody/tr[2]/td/table/tbody/tr/td[2]/table/tbody/tr[1]/td/table/tbody/tr/td/input'
  name = open('boys.txt', encoding='utf-8').readlines()
  browser.find_element_by_xpath(name_xpath).send_keys(random.choice(name))
  
  inn_xpath = '/html/body/form/div[7]/div/div/div[2]/div/div/table/tbody/tr[4]/td/table/tbody/tr/td[2]/table/tbody/tr[1]/td/table/tbody/tr/td/input'
  inn_random = random.randint(1000000000, 9999999999)
  browser.find_element_by_xpath(inn_xpath).send_keys(inn_random)
  
  number_xpath = '/html/body/form/div[7]/div/div/div[2]/div/div/table/tbody/tr[5]/td/table/tbody/tr/td[2]/table/tbody/tr[1]/td/table/tbody/tr/td/input'
  browser.find_element_by_xpath(number_xpath).send_keys('9293454545')
  
  email_xpath = '/html/body/form/div[7]/div/div/div[2]/div/div/table/tbody/tr[6]/td/table/tbody/tr/td[2]/table/tbody/tr[1]/td/table/tbody/tr/td/input'
  mails = open('mails.txt', encoding='utf-8').readlines()
  browser.find_element_by_xpath(email_xpath).send_keys(random.choice(mails))
  
  send_xpath = '/html/body/form/div[7]/div/div/div[3]/div/div/span'
  browser.find_element_by_xpath(send_xpath).click()
  </code></pre>