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:

  1. write selector find <img> tag. in js might like:

    myimg = document.getelementbytagname("img") 
  2. call .src on 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

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -