title: Watir-Webdriver: How can I get the size (file size) of an website image
body: <p>I have the following html code:
          
           
            
           
          </p>
  
  <p>I saw that for Watir-webdriver the "Watir::Image.file_size" method is not currently supported.
  I found out that the "Watir-Classic/Image.rb" has the same method, and it seems that can be used.</p>
  
  <pre><code># this method returns the filesize of the image, as an int
  def file_size
    assert_exists
    @o.invoke("fileSize").to_i
  end
  </code></pre>
  
  <p>I created a method that should retrieve the image size, but it seems I am not initializing the object correctly. Here is my code from the method:</p>
  
  <pre><code>img_src="/location/on_the_server/image"
  chart_image = Watir::Image.new(:src, img_src)
  puts chart_image.file_size
  </code></pre>
  
  <p>The problem is that I receive the following error:</p>
  
  <pre><code>"ArgumentError: invalid argument "/location/on_the_server/image""
  </code></pre>
  
  <p>I saw that for initialization the object requires (container,specifiers). I tried to change the initialization line to "chart_image = Watir::Image.new(img_src, :src)"  but the error keeps appearing.</p>
  
  <p>Could anyone tell me what am I doing wrong?</p>
  
  <p>Is there another way to get the file size of an image from a website?</p>
  
  <p>Thank you.</p>