title: Cannot take screenshot with 0 width
body: <p>I'm trying to take a screenshot of an element inside a Bootstrap's modal. After some struggling, I finally came up with this code:</p>
  
  <pre><code>driver.get('https://enlinea.sunedu.gob.pe/')
  driver.find_element_by_xpath('//div[contains(@class, "img_publica")]').click()
  
  WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.ID, 'modalConstancia')))
  driver.find_element_by_xpath('//div[contains(@id, "modalConstancia")]').click()
  active_element = driver.switch_to.active_element
  active_element.find_elements_by_id('doc')[0].send_keys(graduate.id)
  
  # Can't take this screenshot
  active_element.find_elements_by_id('captchaImg')[0].screenshot_as_png('test.png')
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/home/cesar/Development/manar/venv/lib/python3.7/site-packages/rq/worker.py", line 812, in perform_job
      rv = job.perform()
    File "/home/cesar/Development/manar/venv/lib/python3.7/site-packages/rq/job.py", line 588, in perform
      self._result = self._execute()
    File "/home/cesar/Development/manar/venv/lib/python3.7/site-packages/rq/job.py", line 594, in _execute
      return self.func(*self.args, **self.kwargs)
    File "./jobs/sunedu.py", line 82, in scrap_document_number
      record = scrap_and_recognize(driver, graduate)
    File "./jobs/sunedu.py", line 33, in scrap_and_recognize
      active_element.find_elements_by_id('captchaImg')[0].screenshot_as_png('test.png')
    File "/home/cesar/Development/manar/venv/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py", line 567, in screenshot_as_png
      return base64.b64decode(self.screenshot_as_base64.encode('ascii'))
    File "/home/cesar/Development/manar/venv/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py", line 557, in screenshot_as_base64
      return self._execute(Command.ELEMENT_SCREENSHOT)['value']
    File "/home/cesar/Development/manar/venv/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py", line 633, in _execute
      return self._parent.execute(command, params)
    File "/home/cesar/Development/manar/venv/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
      self.error_handler.check_response(response)
    File "/home/cesar/Development/manar/venv/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
      raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.WebDriverException: Message: unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot take screenshot with 0 width."}
    (Session info: chrome=75.0.3770.100)
    (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 4.4.0-154-generic x86_64)
  </code></pre>
  
  <p>After some debugging, I realize that the element has no width or height:</p>
  
  <pre><code>(Pdb) active_element.find_elements_by_id('captchaImg')[0].rect
  {'height': 0, 'width': 0, 'x': 0, 'y': 0}
  (Pdb) active_element.find_elements_by_id('captchaImg')[0].size
  {'height': 0, 'width': 0}
  </code></pre>
  
  <p>I think that's the cause of the failure. Is there a way to get around this?</p>
  
  <hr>
  
  <p>These are the steps:</p>
  
  <ol>
  <li>Click the link:</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/Ging1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ging1.png" alt="enter image description here"></a></p>
  
  <ol start="2">
  <li>Wait for the modal and fill the first input:</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/ORmR8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ORmR8.png" alt="enter image description here"></a></p>
  
  <ol start="3">
  <li>Try to take the screenshot of the captcha image:</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/TjL0e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TjL0e.png" alt="enter image description here"></a></p>
  
  <p>If I inspect the element (the <code>span</code> that is holding the CAPTCHA image) in the browser I can see that it is actually 100x50:</p>
  
  <p><a href="https://i.stack.imgur.com/M9lQ4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M9lQ4.png" alt="enter image description here"></a></p>