title: Getting the following Message: no such element: Unable to locate element:{“method”:”xpath”,”selector”:”//span[@id=’lblError’]/text()”}”
body: <p>My xpath:</p>
  
  <pre><code>//span[@id=’lblError’]/text()
  </code></pre>
  
  <p>works correctly in developer tools in Chrome. When I use the same xpath in python 2.7 <img src="https://i.stack.imgur.com/nSS9T.png" alt="I use the same xpath in python 2.7">  I get the following error: </p>
  
  <blockquote>
    <p>Message: no such element: Unable to locate element {“method”:”xpath”,”selector”:”//span[@id=’lblError’]/text()”}”</p>
  </blockquote>
  
  <p>In Python 2.7 my xpath is:</p>
  
  <pre><code>driver.find_element_by_xpath(“//span[@id=’lblError’]/text()”)
  </code></pre>
  
  <p>Also if I use <code>("//span[@id=’lblError’]")</code> it does not work as well.</p>
  
  <p>Also I am using python 2.7 with selenium webdriver.</p>