<ul dir="auto">
<li>Electron version: 1.3.13, 1.6.15, 1.7.9, 1.8.2-beta.1</li>
<li>Operating system: Windows 10</li>
</ul>
<h3 dir="auto">Expected behavior</h3>
<ol dir="auto">
<li>Launch electron based app which includes screen sharing capability via getUserMedia</li>
<li>Pick an electron based window (in this example Slack)  to capture contents.</li>
</ol>
<p dir="auto">The contents of the window should be captured.</p>

<h3 dir="auto">Actual behavior</h3>
<ol start="3" dir="auto">
<li>Notice that the captured content stream is black.</li>
</ol>
<p dir="auto">If you try the same steps with chrome M54, M58, M60, M62 the behavior is less broken. When the electron based window is selected for screenshare, the contents are present when the window is in the foreground, and black if the window is in the background.</p>

<h3 dir="auto">How to reproduce</h3>
<ol dir="auto">
<li>Install &amp; run Jitsi-meet-electron <a href="https://github.com/jitsi/jitsi-meet-electron">https://github.com/jitsi/jitsi-meet-electron</a></li>
<li>Join a Jitsi-meet call</li>
<li>Share screen from the toolbar.</li>
<li>Select an application window of another electron app (in this case I continue to select the Slack electron app.</li>
<li>Notice that the shared window contents are always black regardless if the window is in the foreground or background.</li>
</ol>
<h3 dir="auto">Possibly related to</h3>
<p dir="auto">Possible issues in desktopCapturer on Windows 10 <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="167471939" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/6599" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/6599/hovercard" href="https://github.com/electron/electron/issues/6599">#6599</a><br>
and possibly <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=642386" rel="nofollow">https://bugs.chromium.org/p/chromium/issues/detail?id=642386</a></p>
<ul dir="auto">
<li>Output of <code class="notranslate">node_modules/.bin/electron --version</code>:</li>
<li>Operating System (Platform and Version):</li>
<li>Output of <code class="notranslate">node_modules/.bin/electron --version</code> on last known working Electron version (if applicable):</li>
</ul>
<p dir="auto"><strong>Expected Behavior</strong><br>
A clear and concise description of what you expected to happen.<br>
win.webContents.print() to be able to print multiple times and not create unnecessary files in the process.</p>
<p dir="auto"><strong>Actual behavior</strong><br>
A clear and concise description of what actually happened.<br>
When calling win.webContents.print() in windows 10 (behavior not observed on a mac) a .pdf,.ejs.emf and Chinese text file are being created. Printing will work once, then on any further attempt the print function will return success, the job will be added to the printer's queue and then quickly be deleted. I observed this with multiple different printers on a surface pro 5 with windows 10.</p>
<p dir="auto"><strong>To Reproduce</strong><br>
Your best chance of getting this bug looked at quickly is to provide a REPOSITORY that can be cloned and run.</p>
<p dir="auto">You can fork <a href="https://github.com/electron/electron-quick-start">electron-quick-start</a> and include a link to the branch with your changes.</p>
<p dir="auto">If you provide a URL, please list the commands required to clone/setup/run your repo e.g.</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="ipc.on('convert-hash', function(event, hash){
  var id = hashids.decode(hash)[0];
  if(id) event.sender.send('hash-decode', id);
})

var badge_win;

ipc.on('print-to-pdf', function(event, data){

  if(!data.role){
    data.role = &quot;&quot;;
  }

  if(badge_win &amp;&amp; badge_win.close){
    try{
      badge_win.close();
    } catch(e){

    }
  }

  badge_win = new BrowserWindow({width: 1038, height: 1650, show: false});

  ejse.data(data);
  
  badge_win.loadURL(url.format({
    pathname: path.join(__dirname, 'print/index.ejs'),
    protocol: 'file:',
    slashes: true
  }));
})

ipc.on('print-away', function(){
  badge_win.webContents.print({slient:true});
})"><pre class="notranslate">ipc.on(<span class="pl-s"><span class="pl-pds">'</span>convert-hash<span class="pl-pds">'</span></span>, function(event, hash){
  var id = hashids.decode(hash)[0]<span class="pl-k">;</span>
  if(id) event.sender.send(<span class="pl-s"><span class="pl-pds">'</span>hash-decode<span class="pl-pds">'</span></span>, id)<span class="pl-k">;</span>
})

var badge_win<span class="pl-k">;</span>

ipc.on(<span class="pl-s"><span class="pl-pds">'</span>print-to-pdf<span class="pl-pds">'</span></span>, function(event, data){

  if(<span class="pl-k">!</span>data.role){
    data.role = <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span><span class="pl-k">;</span>
  }

  if(badge_win <span class="pl-k">&amp;&amp;</span> badge_win.close){
    try{
      <span class="pl-en">badge_win.close</span>();
    } catch(e){

    }
  }

  badge_win = new BrowserWindow({width: 1038, height: 1650, show: false})<span class="pl-k">;</span>

  ejse.data(data)<span class="pl-k">;</span>
  
  badge_win.loadURL(url.format({
    pathname: path.join(__dirname, <span class="pl-s"><span class="pl-pds">'</span>print/index.ejs<span class="pl-pds">'</span></span>),
    protocol: <span class="pl-s"><span class="pl-pds">'</span>file:<span class="pl-pds">'</span></span>,
    slashes: <span class="pl-c1">true</span>
  }))<span class="pl-k">;</span>
})

ipc.on(<span class="pl-s"><span class="pl-pds">'</span>print-away<span class="pl-pds">'</span></span>, <span class="pl-en">function</span>(){
  badge_win.webContents.print({slient:true})<span class="pl-k">;</span>
})</pre></div>
<p dir="auto"><strong>Screenshots</strong><br>
If applicable, add screenshots to help explain your problem.</p>
<p dir="auto"><strong>Additional Information</strong><br>
NOTE: I was able to switch to 2.0.11 and have this entire process work without a problem.</p>