I'm trying to grab the image filename - my webpage, based on inputs, is loading on of several images and I want to grab the filename of the image. If I know the id or the alt-text, can I grab the image filename? Right now, I'm using "get_html_source" (python, btw) and parsing it from there. Is there an alternative,开发者_运维技巧 or is selenium not really built for this?
Use get_attribute
:
sel.get_attribute('//path/to/my/img@src')
精彩评论