Closed wonderer007 closed 2 years ago
I am trying to attach a file on button click on a website. Normal flow is
Here is what I am trying
Puppeteer.launch(headless: true) do |browser| page = browser.new_page page.goto("https://www.website.com/") dialog = page.query_selector("div.dialog") dialog.click sleep(5) element = await_all( page.async_wait_for_file_chooser, page.async_click(page.query_selector("button.select_file")) ).first element.accept("/path/to/file.png") end
Following is the error trace
W, [2022-09-01T06:23:16.336333 #84971] WARN -- : no implicit conversion of Puppeteer::ElementHandle into String (TypeError) /Users/me/.rvm/gems/ruby-2.6.6/gems/puppeteer-ruby-0.42.0/lib/puppeteer/query_handler_manager.rb:43:in `detect_query_handler' /Users/me/.rvm/gems/ruby-2.6.6/gems/puppeteer-ruby-0.42.0/lib/puppeteer/element_handle.rb:572:in `query_selector' /Users/me/.rvm/gems/ruby-2.6.6/gems/puppeteer-ruby-0.42.0/lib/puppeteer/dom_world.rb:137:in `query_selector' /Users/me/.rvm/gems/ruby-2.6.6/gems/puppeteer-ruby-0.42.0/lib/puppeteer/dom_world.rb:371:in `click' /Users/me/.rvm/gems/ruby-2.6.6/gems/puppeteer-ruby-0.42.0/lib/puppeteer/frame.rb:208:in `click' /Users/me/.rvm/gems/ruby-2.6.6/gems/puppeteer-ruby-0.42.0/lib/puppeteer/page.rb:1210:in `click' /Users/me/.rvm/gems/ruby-2.6.6/gems/puppeteer-ruby-0.42.0/lib/puppeteer/define_async_method.rb:67:in `call' /Users/me/.rvm/gems/ruby-2.6.6/gems/puppeteer-ruby-0.42.0/lib/puppeteer/define_async_method.rb:67:in `block (2 levels) in define_async_method' /Users/me/.rvm/gems/ruby-2.6.6/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/promises.rb:1582:in `evaluate_to' /Users/me/.rvm/gems/ruby-2.6.6/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/promises.rb:1765:in `block in on_resolvable' /Users/me/.rvm/gems/ruby-2.6.6/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:363:in `run_task' /Users/me/.rvm/gems/ruby-2.6.6/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `block (3 levels) in create_worker' /Users/me/.rvm/gems/ruby-2.6.6/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `loop' /Users/me/.rvm/gems/ruby-2.6.6/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `block (2 levels) in create_worker' /Users/me/.rvm/gems/ruby-2.6.6/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `catch' /Users/me/.rvm/gems/ruby-2.6.6/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block in create_worker'
Calling click on input file element solved the issue
I am trying to attach a file on button click on a website. Normal flow is
Here is what I am trying
Following is the error trace