views:

175

answers:

1

I'm trying to get the first href attribute in a page using Selenium RC (in Python):

sel.get_text("xpath=//@href")

this returns an empty string.

However, an identical xpath on the same page inside Firefox (using the "View XPath" extension) yields the correct value.

I've tried fiddling with it, but the same happens for other attributes (eg @class) -- is there something awfully wrong with selenium or am I overlooking something trivial here?

+3  A: 

Did you try using selenium's get_attribute and not get_text ?

Inshim
thanks!i can't imagine why they deviated from the standard..the solution is sel.get_attribute("xpath=//a@href") (for 'a' nodes...)
Gj