<td data-title="Docket No.">"3228"
<div class="cursor-pointer expand-collapse-container expand-document-name">
<div class="expand-arrow" aria-hidden="true"></div>
<div class="collapse-arrow" aria-hidden="true"></div>
</div>
</td>
I am using Selenium and want to get the text that follows
<td data-title="Docket No.">
which in this case is "3228"
I tried:
lastdocket=element.find_element(By.XPATH,'//*[@data-title="Docket No."]/text()').get_attribute('innerHTML')
program crashes and I get:
Message: invalid selector
from javascript error: {"status":32,"value":"The result of the xpath expression \"//*[@data-title=\"Docket No.\"]/text()\" is: [object Text]. It should be an element."}
I then tried getting rid of 'text()' from xpath expression:
lastdocket=element.find_element(By.XPATH,'//*[@data-title="Docket No."]/').get_attribute('innerHTML')
And get this when I print 'lastdocket':
'3228<div class="cursor-pointer expand-collapse-container expand-document-name"><div class="expand-arrow" aria-hidden="true"></div><div class="collapse-arrow" aria-hidden="true"></div></div>'
I realize I could remove thta tags the follow '3228', but is there a way to return just the number???