Answer the question
In order to leave comments, you need to log in
Xpath - how to get an attribute?
Hello.
Why can't I get the href attribute of a link on this page using this xpath (//*[@id="ctl00_ctl00_MainContent_ContentPlaceHolderMiddle_ctl00_SearchResult2"]/tbody/tr[3]/td[4]/a/@href)?
Tell me who knows. I've been scratching my head for days.
Answer the question
In order to leave comments, you need to log in
I solved it like this:
a = browser.find_element_by_xpath('//*[@id="ctl00_ctl00_MainContent_ContentPlaceHolderMiddle_ctl00_SearchResult2"]/tbody/tr[3]/td[4]/a')
b = a.get_attribute('href')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question