Skip to content Skip to sidebar Skip to footer

Getting Text From The Last Hyperlink Tag

I'm trying to access hyperlink texts that will always be stored as the last hyperlink tag nested in 100 div tags on a certain website. In the below example, '00A17' would be what I

Solution 1:

To retrieve the hyperlink text that will always stored as the last hyperlink tag nested in 100 div tags on a certain website e.g. 00A17 you can use the following line of code :

print(driver.find_element_by_xpath("div[@class='headlineText']//a[last()]").get_attribute("innerHTML")) 

Post a Comment for "Getting Text From The Last Hyperlink Tag"