Skip to content

[Bug]: Codegen generates click() and setInputFiles() for operations on <input type="file"> elements, but only setInputFiles() is needed. #40854

@yusuke-noda

Description

@yusuke-noda

Version

1.60.0

Steps to reproduce

  1. Run playwright codegen.
  2. Open page which includes element.
  3. Click and select file(s).
  4. Run generated code.

Expected behavior

Only the line that executes setInputFiles() on the element will be generated.

Alternatively,
executing setInputFiles() will close the file selection dialog.

Actual behavior

Codegen generates lines that execute click() and setInputFiles() for the <input type="file"> element.
However, since setInputFiles() selects a file without needing click(), click() is unnecessary.
Furthermore, the file selection dialog opened by executing click() remains open even after selecting a file by executing setInputFiles().

Additional context

No response

Environment

System:
    OS: Windows 11 10.0.26100
    CPU: (16) x64 Intel(R) Core(TM) i7-10700 CPU @ 2.90GHz
    Memory: 17.80 GB / 31.78 GB
  Binaries:
    Node: 22.20.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.7.0 - C:\Program Files\nodejs\npm.CMD
  IDEs:
    VSCode: 1.120.0 - C:\Users\10383037\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  npmPackages:
    @playwright/test: ^1.60.0 => 1.60.0

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions