title: Download dynamic image on webpage programmatically
body: <p>I'm trying to download an image which changes on every load.
  The <code>src</code> attribute on the <code>img</code> tag is constant, though the image being displayed changes (I'm guessing the web app changes the image at <code>src</code> on every hit).</p>
  
  <p>I did try downloading using <code>src</code>, and the image returned is different, as expected.</p>
  
  <p>My requirement is to download the image that is displayed on the page, at the moment.
  I also tried right click to save, but right click is disabled in the page.
  Any ideas ?
  I'm using selenium webdriver.Other options are also welcome.</p>
  
  <p>This is what I tried using the <code>src</code> attribute :</p>
  
  <pre><code>public static void download() {
      WebDriver driver = new ChromeDriver();
      driver.navigate().to("https://*******.com/");
  
      String url = driver.findElement(By.id("regImg")).getAttribute("src");
  
      // run of the mill code to download the image.
      downloadImage(url);
  }
  </code></pre>
  
  <p>As I said, this code works, but I get a different image as the web app changes it on every hit. I need the one that is displayed on the page.</p>
  
  <p>Here's the HTML:</p>
  
  <pre><code>&lt;td width="20%" align="center" class="style1"&gt;characters
      &lt;font color="#FF0000"&gt;*&lt;/font&gt;
      &lt;img id="regImg" src="../../**/**.php" alt="captcha image" height="25"&gt;
  &lt;/td&gt;
  </code></pre>