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 have this function in my python script which saves html to pdf file and it works fine with selenium locally.
When I use it with selenium grid remotely it throws an error:
result = self.driver.execute_cdp_cmd("Page.printToPDF", print_options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'WebDriver' object has no attribute 'execute_cdp_cmd'
def save_as_pdf(self, path):
directory = os.path.dirname(path)
if not os.path.exists(directory):
os.makedirs(directory)
print_options = {
'landscape': False,
'displayHeaderFooter': False,
'printBackground': True,
'preferCSSPageSize': True
}
# Convert the page to PDF
result = self.driver.execute_cdp_cmd("Page.printToPDF", print_options)
# Decode the base64-encoded PDF data
pdf_data = base64.b64decode(result['data'])
# Write the PDF to a file
with open(path, 'wb') as file:
file.write(pdf_data)
What browsers and operating systems are you seeing the problem on?
Chrome Browser and Ubuntu Operating System
The text was updated successfully, but these errors were encountered:
What happened?
Using docker selenium/standalone-chrome container
I have this function in my python script which saves html to pdf file and it works fine with selenium locally.
When I use it with selenium grid remotely it throws an error:
What browsers and operating systems are you seeing the problem on?
Chrome Browser and Ubuntu Operating System
The text was updated successfully, but these errors were encountered: