Currently using selenium in python and was trying to for loop after locating element by "img" tags in whole webpage. I am trying to save all the urls and img names to my 2 arrays.
imgurl = []
imgname = []
allimgtags = browser.find_element_by_tag_name("img")
for a in len(allimgtags):
imgurl.append(wholeimgtags.get_attribute("src"))
imgname.append(wholeimgtags.get_attribute("alt"))
but i am getting this error in the terminal. How do i save the sub urls and names to my 2 arrays?
Traceback (most recent call last):
File "scrpy_selenium.py", line 31, in <module>
for a in len(wholeimgtags):
TypeError: object of type 'WebElement' has no len()
Aucun commentaire:
Enregistrer un commentaire