dimanche 28 février 2016

how to get link with special word from webpage using selenium and python?

i working in a python script to get all links from webpage that have certain word for example

http://ift.tt/1TIrHJN

http://ift.tt/1n8DAfh

http://ift.tt/1TIrHJP

so the code should get only links that have "about" word in ther links that's are my code put that's give me this error

"AttributeError: 'WebElement' object has no attribute 'get' "

driver.get("http://ift.tt/1lPoTpb")
time.sleep(20)
links = driver.find_elements_by_tag_name("a")
for link in links:
  if '/about/' in link.get( 'href' ):
     print (link.get_attribute("href"))




Aucun commentaire:

Enregistrer un commentaire