I'm trying to extract the contact number (XXXXX-XXXXXX) from the following HTML code using Selenium webdriver's find_element_by_xpath method.
<div id="contact-info">
<div class="a">
<div class="b">
<table class="c">
<tr>
<td class="d">
<div class="e">Contact Info</span></div>
</td>
<td class="f">
<div></div>
</td>
</tr>
</table>
</div>
<div class="g">
<div class="h">
<table>
<tr>
<td>
<div class="i"><span class="j">Mobile</span></div>
</td>
<td class="k">
<div class="random_class_name"><span><span dir="ltr">XXXXX-XXXXXX</span></span>
</div>
</td>
</tr>
</table>
</div>
This is my code for extracting the required data-
print(browser.find_element_by_xpath('//div[@id="contact-info"]/div[1]/div[2]/div[1]/div[2]/span[1]/span[1]').text)
But I'm thrown with an exception saying the element can't be located. What am I possibly doing wrong here? How can I fix this?