I am trying to find the attribute value of the title attribute.
Now, I have a list of similar links on the same page and I want to select the first link and get its title attribute.
I have used the following selenium command:
self.se.get_attribute("css=a[href*='radio?rid=']:nth-of-type(1)@title")
But it is giving me an error.
Could someone please help me figure out the problem?
Thanks
You should use XPath syntax instead of CSS selectors. You didn’t post any HTML to match, so therefore a made up example: to get the title of the first link found in a div with id
myDiv, use the following:Where:
//div[@id='myDiv']matches any div with id “myDiv”;//a[1]select the first link found anywhere in the previously selected div (use2for the second, and so on.@titlespecifies the attribute you want to retrieve.