Got this issue: I'm trying to find the last link on webpage:
try:
elems=self.br.find_elements_by_partial_link_text(category)
except NoSuchElementException:
print 'The Category Name Was Not Found'.category
f=open("error.log","aw")
f.write("Cant find category:%s\n"%category)
f.close()
elems[-1].click()
Now for exmaple the categories I have: Books (Dynamic Number) AudioBooks (Dynamic Number) RomanceBooks (Dynamic Number)
And I try to find "Books" I want to get the first one! (Also it needs to be the last on the source so can't choose first from the elements) One thing that will work with my system if I was able to choose partial_link_text starting with books and not ending? Any ideas? I can't use any other method because It's a really dynamic code and most of the stuff changes...
elems[-1]) but you say you want the first one - the first of thelistyou've made or the first of something else?_partial_link_text?_partial_link_textalso returningelementsfrom the incorrect categories is it perhaps not the best choice of locator in this instance?