G
G
Gric_Art2014-04-08 17:58:11
XPath
Gric_Art, 2014-04-08 17:58:11

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

3 answer(s)
G
Gric_Art, 2014-04-08
@Gric_Art

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')

P
pomeo, 2014-04-08
@pomeo

@Gric_Art and how are you pulling the page, I mean in server language?

V
Vladimir Golovanov, 2014-04-08
@Colwin

So you don't have tbody in this table :-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question