Python 3 + Selenium: Find element by Xpath and text() doesn't work
<p>This is html code:</p>

<pre><code>&lt;td&gt;
  &lt;a href="https://www.facebook.com/n/?confirmemail.php&amp;amp;e=myemail%40gmail.com&amp;amp;c=77438&amp;amp;cuid=AYh3nbnRpQs3d3S9QQ4e74G2jZzOBE69YqYVaWlnPtcs-SOpgHEFilr-khC8FsPUB5zzR6rvBQmgU54QxWdjn2jW9A5OhSaUal_KMcpvARnfDzPrmaOE3ObQrn-cfMk0MYFiR8fT0z8HVc3fX328oMpA&amp;amp;medium=email&amp;amp;mid=53b6ce57e8d3bG5af62793fe75G53b6d2f14900dG3c2Gf8c1&amp;amp;bcode=1.1472715008.AbkQwPz9meBC88Kr&amp;amp;n_m=myemail%40gmail.com" style="color:#3b5998;text-decoration:none" target="_blank" data-saferedirecturl="https://www.google.com/url?hl=en&amp;amp;q=https://www.facebook.com/n/?confirmemail.php%26e%3Dmyemail%2540gmail.com%26c%3D77438%26cuid%3DAYh3nbnRpQs3d3S9QQ4e74G2jZzOBE69YqYVaWlnPtcs-SOpgHEFilr-khC8FsPUB5zzR6rvBQmgU54QxWdjn2jW9A5OhSaUal_KMcpvARnfDzPrmaOE3ObQrn-cfMk0MYFiR8fT0z8HVc3fX328oMpA%26medium%3Demail%26mid%3D53b6ce57e8d3bG5af62793fe75G53b6d2f14900dG3c2Gf8c1%26bcode%3D1.1472715008.AbkQwPz9meBC88Kr%26n_m%3Dmyemail%2540gmail.com&amp;amp;source=gmail&amp;amp;ust=1472802324130000&amp;amp;usg=AFQjCNH7AgCibBYBB8I6ECqWXnFcMbwhMw"&gt;
    &lt;table style="border-collapse:collapse" cellpadding="0" cellspacing="0" width="100%"&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;td style="border-collapse:collapse;border-radius:2px;text-align:center;display:block;border:solid 1px #344c80;background:#4c649b;padding:7px 16px 11px 16px"&gt;
            &lt;a href="https://www.facebook.com/n/?confirmemail.php&amp;amp;e=myemail%40gmail.com&amp;amp;c=77438&amp;amp;cuid=AYh3nbnRpQs3d3S9QQ4e74G2jZzOBE69YqYVaWlnPtcs-SOpgHEFilr-khC8FsPUB5zzR6rvBQmgU54QxWdjn2jW9A5OhSaUal_KMcpvARnfDzPrmaOE3ObQrn-cfMk0MYFiR8fT0z8HVc3fX328oMpA&amp;amp;medium=email&amp;amp;mid=53b6ce57e8d3bG5af62793fe75G53b6d2f14900dG3c2Gf8c1&amp;amp;bcode=1.1472715008.AbkQwPz9meBC88Kr&amp;amp;n_m=myemail%40gmail.com" style="color:#3b5998;text-decoration:none;display:block" target="_blank" data-saferedirecturl="https://www.google.com/url?hl=en&amp;amp;q=https://www.facebook.com/n/?confirmemail.php%26e%3Dmyemail%2540gmail.com%26c%3D77438%26cuid%3DAYh3nbnRpQs3d3S9QQ4e74G2jZzOBE69YqYVaWlnPtcs-SOpgHEFilr-khC8FsPUB5zzR6rvBQmgU54QxWdjn2jW9A5OhSaUal_KMcpvARnfDzPrmaOE3ObQrn-cfMk0MYFiR8fT0z8HVc3fX328oMpA%26medium%3Demail%26mid%3D53b6ce57e8d3bG5af62793fe75G53b6d2f14900dG3c2Gf8c1%26bcode%3D1.1472715008.AbkQwPz9meBC88Kr%26n_m%3Dmyemail%2540gmail.com&amp;amp;source=gmail&amp;amp;ust=1472802324130000&amp;amp;usg=AFQjCNH7AgCibBYBB8I6ECqWXnFcMbwhMw"&gt;
              &lt;center&gt;
                &lt;font size="3"&gt;
                  &lt;span style="font-family:Helvetica Neue,Helvetica,Lucida Grande,tahoma,verdana,arial,sans-serif;white-space:nowrap;font-weight:bold;vertical-align:middle;color:#ffffff;font-size:14px;line-height:14px"&gt;Confirm&amp;nbsp;Your&amp;nbsp;Account
                  &lt;/span&gt;
                &lt;/font&gt;
              &lt;/center&gt;
            &lt;/a&gt;
          &lt;/td&gt;
        &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/a&gt;
&lt;/td&gt;
</code></pre>

<p>This is my code which click a confirm FB link in gmail:</p>

<pre><code>confirm = WebDriverWait(driver,10).until(EC.presence_of_element_located((By.XPATH, ".//*[text()='Confirm Your Account']")))
confirm.click()
</code></pre>

<p>It always show TimeOutException error in the first line. Can you fix my code ? Thank you :)</p>

<p>Try to check if the element contains the text instead of exact match</p>

<pre><code>((By.XPATH, ".//*[contains(text(), 'Confirm Your Account')]"))
</code></pre>

<p>Or</p>

<pre><code>((By.XPATH, ".//*[contains(., 'Confirm Your Account')]"))
</code></pre>

python selenium xpath