title: Getting value of a class in selenium and python
body: <pre><code>&lt;input id="value(Medications1)_139038" class="medMedications text-field" type="text" style="width:90%" value="Lantus" maxlength="30000" name="value(Medications1)" autocomplete="off"/&gt;
  </code></pre>
  
  <p>So there is this page where there are textboxes and these textboxes are not fixed in number. other times it could be 20 and sometimes just 5 it's random. So is there a way to know how many of these textboxes are in the page? and get the values of those textboxes?</p>
  
  <p>I've tried this:</p>
  
  <pre><code>medicationstextbox_locator = "//*[@class='medMedications text-field ']"
  medicationstextbox_locatorTextBox = driver.find_elements_by_xpath(medicationstextbox_locator)
  
  for i in medicationstextbox_locatorTextBox:
      print(i.get_attribute("values"))
  </code></pre>
  
  <p>this prints out a lot of <code>None</code>.</p>
  
  <p>I don't get it caused I've accessed it's class, pulled the value but it returns <code>None</code>.</p>
  
  <p>If it's possible I'd want to avoid doing:</p>
  
  <pre><code>medications1 = "//input[@name='value(Medications1)']"
  medications2 = "//input[@name='value(Medications2)']"
  
  med1textbox = driver.find_element_by_xpath(med1)
  med2textbox = driver.find_element_by_xpath(med2)
  
  med1textbox.get_attribute("value")
  med2textbox.get_attribute("value")
  </code></pre>
  
  <p>because I'd have to define each textbox and the number of textboxes is not known beforehand. It would also take so much time to do it this way. So, how do we solve this?</p>