Raises error when i use print_pdf()only in EDGE headful mode:
def print_pdf(self, path=None, print_options=None):
"""Print the current page as a PDF file.
Args:
path (str, optional): The path for the file to be saved. Defaults to None.
print_options (dict, optional): Print options as defined at. Defaults to None.
Returns:
str: the saved file path
"""
title = self.page_title() or "document"
timeout = 60000
default_path = os.path.expanduser(os.path.join(self.download_folder_path, f"{title}.pdf"))
if self.browser in [Browser.CHROME, Browser.EDGE] and not self.headless:
pdf_current_count = self.get_file_count(file_extension=".pdf")
# Chrome still does not support headless webdriver print
# but Firefox does.
self.execute_javascript("window.print();")
# We need to wait for the file to be available in this case.
if self.page_title():
self.wait_for_file(default_path, timeout=timeout)
else:
# Waiting when the file don't have the page title in path
self.wait_for_new_file(file_extension=".pdf", current_count=pdf_current_count)
# Move the downloaded pdf file if the path is not None
if path:
last_downloaded_pdf = self.get_last_created_file(self.download_folder_path, ".pdf")
> os.rename(last_downloaded_pdf, path)
E PermissionError: [WinError 32] O arquivo já está sendo usado por outro processo: 'D:\\BotCity\\projetos\\dev\\web\\Botcity - web test.pdf' -> 'D:\\BotCity\\projetos\\dev\\web\\page.pdf'
venv\lib\site-packages\botcity\web\bot.py:992: PermissionError
Describe the bug
Raises error when i use
print_pdf()
only in EDGE headful mode:Expected behavior Save pdf and rename.
Steps to Reproduce
My Platform
botcity-framework-web==0.4.0