YusukeIwaki / playwright-ruby-client

Playwright client for Ruby
https://playwright-ruby-client.vercel.app/
MIT License
336 stars 34 forks source link

ElementHandle#set_input_files shoula allow Pathname and File #229

Closed YusukeIwaki closed 1 year ago

YusukeIwaki commented 1 year ago

Step To Reproduce / Observed behavior

element = page.query_selector('input')
element.set_input_files(File.new('./test.rb'))

causes

    Errno::ENOENT:
       No such file or directory @ rb_stat_init - # frozen_string_literal: true

File is enumerable. So https://github.com/YusukeIwaki/playwright-ruby-client/blob/bb3ddf54c292a348d538f0f666c35ecc5f4472e1/lib/playwright/input_files.rb#L7 this doesn't work as expected.

[3] pry(#<Playwright::InputFiles>)> @files.is_a?(File)
=> true
[4] pry(#<Playwright::InputFiles>)> @files.is_a?(Enumerable)
=> true

Expected behavior

set upload file

Environment

Paste the output of ruby --version