-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: Add .print()
command in nightwatch.
#4198
Comments
@garg3133 Should I add this command in Nightwatch? It is there in the W3C webdriver. |
@Ayush-Vish Yes, it is a good idea to go ahead with it. All major the browsers support printing https://wpt.fyi/results/webdriver/tests/classic/print?label=master&label=experimental&aligned&view=subtest |
@pujagani Definitely, I will come up with a solution to implement it. |
Nightwatch has a "method-mappings.js" class which maps Nightwatch methods to the underlying Selenium method. That might be a good place to start. |
@pujagani Absolutely, I'll definitely check that out! |
I am new to open source contributions. Can i try working on this issue?? |
I got this working by mapping to the printPage command from selenium webdriver inside method-mappings.js and exposing it through a lib/api/protocol command. Some questions though, printPage outputs to a base64-encoded string. What do we want to ultimately do with it? For example, I can use fs and write that to a PDF file on the system. Would we use the screens folder from nightwatch.conf.js or allow the user to provide the save path in the command parameters? If we want to embed the PDF in the Nightwatch HTML report as @Ayush-Vish suggested in the original post here I would need to see some documentation on how to do that though. @pujagani how do you think we should expose the output of the command? One of the options I suggested or something else? |
Thank you for helping out with this. "What do we want to ultimately do with it? For example, I can use fs and write that to a PDF file on the system" - I think this is a good idea. To write it to a PDF. Maybe we could use that screens folder if the user does not provide a path. What do you think about that? Regarding the HTML reporter integration, it should be a separate set of changes. I honestly don't think there is a contributing doc for it. But you can probably follow the way the screenshot was handled there. There is a separate conf too for the screenshot. Maybe print page can have something similar. |
Description
This command will return a PDF of the paginated pages, which will be helpful for the overall view of the website.
This pdf will be shown in the respective HTML Report.
Suggested solution
No response
Alternatives / Workarounds
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: