html - Extract (random) image with no useful src= from web page -
first i'd know how can achieved in general, , maybe knows how accomplish using capybara.
example: <img src="http://example.com/getrandomimage"> thing is, src points script returns random image, not image itself. page loaded, script run, image displayed. can src value, if access link download image, script runs again , returns totally different picture. , need 1 that's on page.
i think process similar using js or capybara. i'd break down 2 steps:
write selector find
<img>tag. in js might like:myimg = document.getelementbytagname("img")call
.srcon returned node:result = myimg.src
i believe capybara limited xpath , css selectors. therefore, depending on page trying scrape, you'll have identify sort of pattern in html tags or css attributes find <img> tag.
Comments
Post a Comment