You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a particular case, creating the file and calling the function at the same time it happened that the first file was overwritten by the second one that was being generated. The error does not seem to be reproducible in a standard way but only after X attempts.
How can we reproduce the issue?
print_settings = {
"recentDestinations": [{
"id": "Save as PDF",
"origin": "local",
"account": "",
}],
"selectedDestinationId": "Save as PDF",
"version": 2,
"isHeaderFooterEnabled": False,
"isLandscapeEnabled": True
}
user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_2) AppleWebKit/537.36 (KHTML, like Gecko) ' \
'Chrome/110.0.0.0 Safari/537.36'
options = webdriver.ChromeOptions()
options.add_argument(f'user-agent={user_agent}')
options.add_argument("--start-maximized")
options.add_argument('--window-size=1920,1080')
options.add_argument(f"user-data-dir=path/tmp/")
options.add_argument("--headless")
options.add_argument('--disable-gpu')
options.add_argument('--no-sandbox')
options.add_argument('--enable-print-browser')
options.add_experimental_option("prefs", {
"printing.print_preview_sticky_settings.appState": json.dumps(print_settings),
"savefile.default_directory": f'path/tmp/', # Change default directory for downloads"download.default_directory": f'path/tmp/', # Change default directory for downloads"download.prompt_for_download": False, # To auto download the file"download.directory_upgrade": True,
"profile.default_content_setting_values.automatic_downloads": 1,
"safebrowsing.enabled": True
})
options.add_argument("--kiosk-printing")
#driver = Chrome(service=service, options=options)
driver = Chrome( options=options)
html_bs64 = base64.b64encode(body.encode('utf-8')).decode()
driver.get("data:text/html;base64," + html_bs64)
pdf_data = driver.execute_cdp_cmd("Page.printToPDF", print_settings)
driver.quit()
f = open(fname_dir, 'wb')
f.write(base64.b64decode(pdf_data['data']))
f.close()
Relevant log output
no log output
Operating System
ubuntu
Selenium version
pytohn selenium==4.24.0
What are the browser(s) and version(s) where you see this issue?
Chrome 110
What are the browser driver(s) and version(s) where you see this issue?
Chrome 110
Are you using Selenium Grid?
No response
The text was updated successfully, but these errors were encountered:
@morettolss, thank you for creating this issue. We will troubleshoot it as soon as we can.
Info for maintainers
Triage this issue by using labels.
If information is missing, add a helpful comment and then I-issue-template label.
If the issue is a question, add the I-question label.
If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.
If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C),
add the applicable G-* label, and it will provide the correct link and auto-close the
issue.
After troubleshooting the issue, please add the R-awaiting answer label.
What happened?
I had a particular case, creating the file and calling the function at the same time it happened that the first file was overwritten by the second one that was being generated. The error does not seem to be reproducible in a standard way but only after X attempts.
How can we reproduce the issue?
Relevant log output
Operating System
ubuntu
Selenium version
pytohn selenium==4.24.0
What are the browser(s) and version(s) where you see this issue?
Chrome 110
What are the browser driver(s) and version(s) where you see this issue?
Chrome 110
Are you using Selenium Grid?
No response
The text was updated successfully, but these errors were encountered: