Close browser after every selenium use
This commit is contained in:
parent
66c08522f7
commit
e91116fe1b
1 changed files with 3 additions and 0 deletions
|
@ -300,16 +300,19 @@ class SeleniumPDFRender(BasePdfMaker):
|
|||
except TimeoutException:
|
||||
logger.error('PDF math rendering timed out')
|
||||
self.log = self.get_log(browser) + '\nPDF math rendering timed out'
|
||||
browser.quit()
|
||||
return
|
||||
response = browser.execute_cdp_cmd('Page.printToPDF', self.template)
|
||||
self.log = self.get_log(browser)
|
||||
if not response:
|
||||
browser.quit()
|
||||
return
|
||||
|
||||
with open(self.pdffile, 'wb') as f:
|
||||
f.write(base64.b64decode(response['data']))
|
||||
|
||||
self.success = True
|
||||
browser.quit()
|
||||
|
||||
|
||||
if HAS_PUPPETEER:
|
||||
|
|
Loading…
Reference in a new issue