title: Difference in behaviour between java and python
body: <p>I am trying to get the list of all web elements by accessing top <code>//div[@class="Class1"]</code> using xpath in python.</p>
  
  <p><strong>HTML Code:</strong></p>
  
  <pre><code>&lt;div id="ID1" class="Class1"&gt;
  &lt;div id="SubID1" class="Class2"&gt;
  &lt;table id="Tid1" class="Class3"&gt;
  &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;span class='Class4'&gt;Samplecontrol1&lt;/span&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
      &lt;/div&gt;
      &lt;div id="SubID2" class="Class2"&gt;
          &lt;table id="Tid2" class="Class3"&gt;
              &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;span class='Class4'&gt;Samplecontrol2&lt;/span&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
          &lt;/div&gt;
      &lt;div id="SubID3" class="Class2"&gt;
          &lt;table id="Tid3" class="Class3"&gt;
              &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;span class='Class4'&gt;Samplecontrol3&lt;/span&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
          &lt;/div&gt;
      &lt;div id="SubID4" class="Class2"&gt;
          &lt;table id="Tid4" class="Class3"&gt;
              &lt;tbody&gt;
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;span class='Class4'&gt;Samplecontrol4&lt;/span&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
          &lt;/div&gt;
      &lt;div id="SubID5" class="Class2"&gt;
          &lt;table id="Tid5" class="Class3"&gt;
              &lt;tbody&gt;`enter code here`
                  &lt;tr&gt;
                      &lt;td&gt;
                          &lt;span class='Class4'&gt;Samplecontrol5&lt;/span&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/tbody&gt;
          &lt;/table&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Python Code:</strong></p>
  
  <pre><code>    def MainLogin(self):
   #wDriver = webdriver.Firefox(executable_path='C:/Eclipse/SelDriver/geckodriverWin64.exe')
   eleToolBox = webelement.FirefoxWebElement
   x =''
   index=0
   self.wDriver.get(self.URL)
   self.wDriver.maximize_window()    
   eleToolBox =            self.wDriver.find_elements_by_xpath('//div[@class="Class1"]')
   self.wDriver.implicitly_wait(10)                   
   for item in eleToolBox:
       print(item.text)            
  </code></pre>
  
  <p>In first loop <code>print(item.text)</code>  statement returns all elements </p>
  
  <p><strong>OUTPUT:</strong></p>
  
  <pre><code>Samplecontrol1
  Samplecontrol2
  Samplecontrol3
  Samplecontrol4
  Samplecontrol5
  </code></pre>
  
  <p>Which is quite confusing for me. I was expecting the output <code>Samplecontrol1</code> values. </p>
  
  <p>I try the same case in Java by taking <code>List &lt;Webelements&gt;</code>, iterator interface and it working as per my expectation. In java we can access value of sub-element by it's index to access it properties\values. </p>
  
  <p>My confusion is why in python return all element in first iteration. What if I wants to iterate individual element is it possible in python.</p>