-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Support takeScreenshot #11
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
Conversation
); | ||
async takeScreenshot( | ||
browserId: string, | ||
screenshotPath: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The screenshotPath
has already been converted to an absolute path and has the .png
extension added by TestCafe. There's no need for further validation.
Additionally, it can create directories recursively, so we don't need to validate the directory's existence either.
) { | ||
if (fullPage) { | ||
console.warn( | ||
'Taking a full-page screenshot on the remote browser is not supported.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No fullPage
is mentioned in TestCafe plugin-host.js, but it can still be passed via t.takeScreenshot(path, fullPage)
. It is better to provide a warning message to indicate that full-page screenshots do not work for remote browsers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, how exactly does takeElementScreenshot
support work? I don't see a call to webdriver.takeElementScreenshot
anywhere?
Then extra crop would be applied after getting the screenshot. |
Description
It can support
.takeScreenshot()
and.takeElementScreenshot()
both.Note: The TestCafe Official provider also takes screenshots for BiDi browser types. I've checked our documentation, and we haven't enabled BiDi yet in this provider. Additionally, supporting BiDi features requires
[email protected]+
, which is a pure ESM package, causing several issues for now.So, in this PR, I only added the functionality for taking screenshots for the W3C browser type.