The phone number is an element, and I need to get the inner text.
<a href="tel:895**49****" class="button-text action-link" title="Телефон продавца" rel="nofollow">
"8 9** **9-99-**"
</a>
When I use
phone = driver.find_element_by_class_name('button-text')
print phone.text
it returns an empty string, because the phone number in "" is an text() node.
And when I try
print driver.find_element_by_xpath('/html/body/section/article/section[2]/ul/li[1]/a/text()')
or this
print driver.find_element_by_xpath('/html/body/section/article/section[2]/ul/li[1]/a/text()').text
it returns this error:
InvalidSelectorException: Message: u'Error Message => 'The result of the xpath expression "/html/body/section/article/section[2]/ul/li[1]/a/text()" is: [object Text]. It should be an element.