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

[wptrunner] Create shared WebDriverPrintRefTestExecutor implementation #48237

Closed
jonathan-j-lee opened this issue Sep 17, 2024 · 0 comments · Fixed by #48238
Closed

[wptrunner] Create shared WebDriverPrintRefTestExecutor implementation #48237

jonathan-j-lee opened this issue Sep 17, 2024 · 0 comments · Fixed by #48238
Assignees
Labels
infra wptrunner The automated test runner, commonly called through ./wpt run

Comments

@jonathan-j-lee
Copy link
Contributor

The WebDriver spec defines an endpoint to print a page as a PDF, so it seems possible to run print-reftests the same way between WebDriver-compliant browsers.

This will also let us replace a direct nonstandard call to CDP in Chromium's print-reftest executor:

def render_as_pdf(self, width, height):
margin = 0.5
params = {
# Chrome accepts dimensions in inches; we are using cm
"paperWidth": width / 2.54,
"paperHeight": height / 2.54,
"marginLeft": margin,
"marginRight": margin,
"marginTop": margin,
"marginBottom": margin,
"shrinkToFit": False,
"printBackground": True,
}
return self.parent.cdp.execute_cdp_command("Page.printToPDF", params)["data"]

... which mostly lines up with WebDriver's /session/<id>/print already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infra wptrunner The automated test runner, commonly called through ./wpt run
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant