title: I am trying Selenium Webdriver to find input element by class name
body: <p>How to find element <code>input class="Test_type"</code>? I successfully got by <code>id=Test1</code> but failing to find element by <code>input class="Test_type"</code></p>
  
  <p>I have tried:</p>
  
  <pre><code>WebElement mainform = driver.findElement(By.className("mainform"));
  
  List&lt;WebElement&gt; postadchildone2 = mainform.findElements(By.className("formrow"))
  
  for(WebElement formrow: postadchildone2)
  {
      WebElement formfield = formrow.findElement(By.className("formfield"));
      WebElement inputclass = formfield.findElement(By.className("Test_type"))
  
  }
  </code></pre>
  
  <p>Also tried using CSS selector &amp; XPath, however still it says didn't found, because of the same class name it is not finding <code>input class</code>.</p>
  
  <p>Under <code>for</code> loop I tried doing </p>
  
  <pre><code>formrow.getText()
  </code></pre>
  
  <p>It displays all the text results but it is not taking class name? I am stuck please help</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div class="mainform"&gt;
    &lt;div class="formrow"&gt;
      &lt;div class="formrow"&gt;
        &lt;div class="formrow"&gt;
          &lt;div class="formfield"&gt;
            &lt;div id="Test1" class="city_select"&gt;
              &lt;div class="blank1"/&gt;
              &lt;div class="formrow " style="margin-left:10px;"&gt;
                &lt;div class="formrow"&gt;
                  &lt;div class="formlabel"&gt;
                     &lt;strong&gt;You Are&lt;/strong&gt;
                  &lt;/div&gt;
                  &lt;div class="formfield"&gt;
                    &lt;label&gt;
                      &lt;input class="Test_type required" type="radio"/&gt;
                      YouareTest
                    &lt;/label&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>