microsoft / playwright-java

Java version of the Playwright testing and automation library
https://playwright.dev/java/
Apache License 2.0
1.06k stars 195 forks source link

[Bug]: Caret Screenshot #1595

Open erdemgurell opened 3 weeks ago

erdemgurell commented 3 weeks ago

Version

1.43.0

Steps to reproduce

  1. Java 11 Maven project in IntelliJ IDEA 2024.1
  2. Clone my repo: https://github.com/erdemgurell/Playwright_LearningProject.git
  3. Go to src/test/java/LambdaTest/day4/Screenshots.java and run the file.

Expected behavior

Take a screenshot of the input element with the caret hidden and save it to a fil

Actual behavior

It gives this error:

com.microsoft.playwright.PlaywrightException: Error message='caret: expected one of (hide|initial) name='Error stack='Error: caret: expected one of (hide|initial)

Additional context

I think it's about enums in ScreenshotCaret class

Environment

yury-s commented 3 weeks ago

I was not able to reproduce it. Can you run it from terminal and share your command if it fails there?

erdemgurell commented 3 weeks ago

I don't know how to run it from terminal. What should I do?

yury-s commented 3 weeks ago

Configure it to work with mvn test? I just want to rule out any potential issues related to us running it in different environments.

erdemgurell commented 3 weeks ago

I figured out mvn test and here are the results:

image

yury-s commented 3 weeks ago

Can you update you repository and provide instructions how to reproduce it? We can't debug screenshots.

erdemgurell commented 2 weeks ago

I updated the repository and commented every step. Here are the reproduce steps:

  1. Navigate to "https://www.lambdatest.com/selenium-playground/simple-form-demo"
  2. Create a new instance of ScreenshotOptions
  3. Create a Locator for the Single Input Field (my selector: "input#user-message")
  4. Then used method: input.scrollIntoViewIfNeeded();
  5. Click the input element
  6. Take a screenshot of the input element with the caret hidden and save it to a file
  7. Take a screenshot of the input element with the caret in its initial state and save it to a file