How to take a screenshot of cesium?

When I use this method to take a screenshot of cesium I only get a whole black image. Has any one encountered this problem?

import html2canvas from 'html2canvas';
html2canvas(document.body, {
       allowTaint: false,
       useCORS: true,
}).then((canvas) => {
       const dataImg = new Image();
       dataImg.src = canvas.toDataURL('image/png', 1.0);
});

Please try

viewer.scene.render();

before canvas.toDataURL

thank you everybody!Finally I figured out how to save the gis’ canvas with dom element. :smiling_face_with_three_hearts:

viewer.render();
html2canvas(document.body, {
       allowTaint: false,
       useCORS: true,
}).then((canvas) => {
      const dataImg = new Image();
      console.log(canvas.toDataURL('image/png', 1.0));
});