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

[Bug]: Java - Can't upload file since 1.40 Playwright version but it works in 1.39 #30478

Closed
Benjamiche opened this issue Apr 23, 2024 · 1 comment

Comments

@Benjamiche
Copy link

Version

1.43.0

Steps to reproduce

Requirements : Playwright JAVA version > 1.39

Go to this URL (for example to test upload) : [https://www.file.io/]

You will find my java code below :

FileChooser fileChooser = page.waitForFileChooser(() -> page.locator("[for='upload-button']").click()); fileChooser.setFiles(Paths.get("src/test/resources/pictures/media-add-picture.jpg"));

Can you help me please ?

Expected behavior

My file is uploaded with success !

Actual behavior

This code works in Java Playwright version 1.39 but for future version from 1.40 to latest, I still encounter this error :

java.lang.NullPointerException: Cannot invoke "com.google.gson.JsonElement.getAsJsonArray()" because the return value of "com.google.gson.JsonObject.get(String)" is null

StackTrace :
at io.github.uchagani.allure.playwright.ChannelOwnerAspect.getStepNameForSetInputFiles(ChannelOwnerAspect.java:138) at io.github.uchagani.allure.playwright.ChannelOwnerAspect.getStepName(ChannelOwnerAspect.java:172) at io.github.uchagani.allure.playwright.ChannelOwnerAspect.beforeActionMethods(ChannelOwnerAspect.java:79) at com.microsoft.playwright.impl.ChannelOwner.sendMessage(ChannelOwner.java:105) at com.microsoft.playwright.impl.ElementHandleImpl.setInputFilesImpl(ElementHandleImpl.java:474) at com.microsoft.playwright.impl.FileChooserImpl.lambda$setFiles$0(FileChooserImpl.java:62) at com.microsoft.playwright.impl.LoggingSupport.lambda$withLogging$0(LoggingSupport.java:36) at com.microsoft.playwright.impl.LoggingSupport.withLogging(LoggingSupport.java:47) at com.microsoft.playwright.impl.ChannelOwner.withLogging(ChannelOwner.java:89) at com.microsoft.playwright.impl.LoggingSupport.withLogging(LoggingSupport.java:35) at com.microsoft.playwright.impl.FileChooserImpl.setFiles(FileChooserImpl.java:61) at com.microsoft.playwright.impl.FileChooserImpl.setFiles(FileChooserImpl.java:56) at com.microsoft.playwright.FileChooser.setFiles(FileChooser.java:91)

Additional context

No response

Environment

OS : Fedora Linux 39 (Workstation Edition) x64
Gnome : 45.5 (Wayland)
Linux kernel : 6.8.6-200

AdoptOpenJDK : 17

Browsers :
  - chromium : 124.0.6367.29 from (download by Playwright from https://playwright.azureedge.net/builds/chromium/1112/chromium-linux.zip)
@Benjamiche
Copy link
Author

I close this ticket.

The problem was this dependency :

<dependency> <groupId>io.github.uchagani</groupId> <artifactId>allure-playwright-java</artifactId> <version>${allure.playwright.version}</version> </dependency>

If I comment it, my file upload works

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

No branches or pull requests

1 participant