Skip to content
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

Add /print command to web driver #268

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

marwan-at-work
Copy link

Hi there,
Thank you for this helpful library. I noticed that the print command is somewhat less documented and also missing from this library so I added here.

The print command is described in the following spec: https://www.w3.org/TR/webdriver/#endpoints

Note there are more arguments to be added but I only added the ones I am using and have tested. Later on, people can add more arguments as needed. Otherwise, I'm happy to add all of the arguments.

Copy link
Collaborator

@minusnine minusnine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for the extremely high latency in this review. Thank you very much for your contribution.

@@ -396,6 +412,8 @@ type WebDriver interface {
KeyUp(keys string) error
// Screenshot takes a screenshot of the browser window.
Screenshot() ([]byte, error)
// Print takes PrintArgs and returns a PDF representation of the browser window.
Print(args PrintArgs) ([]byte, error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you please add a new test function in internal/seleniumtest/seleniumtest.go. It will be similar to this test and should be added just below it:

func testDismissAlert(t *testing.T, c Config) {

The function call should be added to commonTests, after this line:

t.Run("DismissAlert", runTest(testDismissAlert, c))

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@minusnine done

selenium.go Outdated Show resolved Hide resolved
selenium.go Outdated Show resolved Hide resolved
@Archie1978
Copy link

you know when the merge will happen to use it ?
I would like to make a PDF printout of a screen :)

Marwan Sulaiman and others added 2 commits June 6, 2022 19:07
Co-authored-by: Eric Garrido <eric@ericgar.com>
@Archie1978
Copy link

Hello, marwan-at-work can you add PrintOrientation ? The code is below.

I have small problems under firefox for printing but with chrome it's good.

`
// PrintArgs specify the arguments that can
// be sent to the Print() command.

type PrintArgs struct {
Scale float64 `json:"scale,omitempty"`
PageRanges []string `json:"pageRanges,omitempty"`
Margin *Margin `json:"margin,omitempty"`
Orientation PrintOrientation `json:"orientation,omitempty"`
}
type PrintOrientation string
const (
PrintOrientationPortrait PrintOrientation = "portrait"
PrintOrientationLandscape PrintOrientation = "landscape"
)
`

@marwan-at-work
Copy link
Author

@Archie1978 done

@marwan-at-work
Copy link
Author

Any updates here? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants