-
Notifications
You must be signed in to change notification settings - Fork 190
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
[BUG] Locator screenshot call fails #737
Comments
Thanks for the detailed report, very helpful!
There is a problem related to use of reflection and modules in newer java versions. We had similar problem in the past. I'll prepare a fix.
Yes, you are absolutely right, there is a bug in the docs. Sent a patch.
|
@AutomationPanda can you try it with |
Thanks @yury-s! I'll give it a try shortly. Thanks also for fixing the docs. +1 to using Locators over ElementHandles. I completely agree. |
I verified the fix with this snapshot build: |
Context
Code Snippet
Describe the bug
When I try to take a screenshot of an individual locator using the above code snippet on the given page, it fails with the following stack trace:
I'm not sure why this fails, but the code looks like it should work.
On the other hand, I can take a screenshot of a full page like this:
I can also successfully take a screenshot of an individual element like this:
For some reason, the Locator method just doesn't work.
Doc Issue
I also discovered what appears to be a typo in the docs here:
https://playwright.dev/java/docs/screenshots#element-screenshot
The doc shows this code:
I believe this call should use
Locator.ScreenshotOptions
instead ofElementHandle.ScreenshotOptions
.Alternatively, the docs could use
page.querySelector
instead ofpage.locator
.The text was updated successfully, but these errors were encountered: