title: How to get Error message text using xpath in selenium python?
body: <p>I am trying to get the error text from the below using XPath</p>
  <p><code>&lt;p id=&quot;username-error&quot; class=&quot;error-msg&quot; role=&quot;alert&quot; data-error=&quot;messages.INVALID_USERNAME&quot;&gt;Sorry, we don't recognize this&amp;nbsp;email.&lt;/p&gt;</code></p>
  <p>here is my code:</p>
  <p><code>message = driver.find_element_by_xpath('//*[@id=&quot;username-error&quot;]').text</code></p>
  <p>This piece of code is not returning anything. Kindly help me to get the error text such as &quot;Sorry, we don't recognize this email.&quot;</p>