title: Using selenium drivers to Print to PDF
body: <p>I am struggling with a problem.</p>
  <p>I need to download PDF file when the Print dialog appears.</p>
  <p>Here is an example of the dialog</p>
  <p><a href="https://i.stack.imgur.com/1gEau.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1gEau.png" alt="enter image description here" /></a></p>
  <p>I have tried both the chrome and firefox drivers. But unfortunately still cannot get it working.</p>
  <p>I have found the following preference for the firefox</p>
  <pre><code>    fp.setPreference(&quot;print.print_to_file&quot;, true);
  </code></pre>
  <p>But it seems that it doesn't work.
  It doesn't even get applied into the configuration variables set.</p>
  <p>Please suggest any way to automate some actions with selenium and then save to PDF file when this print dialog appears.</p>