私はさまざまなオプションを持つファイルを添付しようとしましたが、機能しません。カピバラは入力タグ付きファイルを添付していません
1)attach_file('file-input', Rails.root + 'spec/files/books.jpg',:visible => false)
Error: Unable to find file field "file-input"
私はCSSを見つけることができ、そのpage.has_css? ('.file-input')
を使用している場合。
2)attach_file('#library_resource_files', Rails.root + 'spec/files/books.jpg',:visible => false)
Error: Unable to find file field "file-input"
シナリオ:正常に動作しているアップロードボタンclick_link 'アップロード' をクリックします。 とポップアップが開きます。どこにファイルを添付するためにボタンをクリックする必要がありますか?ここで
はHTMLである: - http://www.rubydoc.info/gems/capybara/Capybara/Node/Actions#attach_file-instance_method -attach_file
のためのドキュメントから
<input multiple="multiple" accept="image/*,
audio/*,
video/*,
application/x-shockwave-flash,
application/vnd.adobe.flash.movie,
application/pdf,
application/msword,
application/vnd.google-apps.*,
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
application/vnd.openxmlformats-officedocument.presentationml.presentation,
application/vnd.openxmlformats-officedocument.wordprocessingml.document,
application/octet-stream,
text/plain"
class="file-input" type="file"
name="library_resource[files][]" id="library_resource_files">
attach_file呼び出す前に、それが見えるように
execute_script
を使用して入力CSSを変更する必要がありますreplying..Iためのトーマスは本当に感謝ありがとうございます。どの入力要素が隠されているかを特定する方法を教えてください。上記のhtmlで私は識別することができません。してください。もう一度おねがいします - – Meg@Meg私はそれが隠されているのか分かりません。実際のブラウザでページを開いているかどうかを調べ、要素を調べたり、ページ上にスペースがあるかどうか、透明であるかどうか(不透明度:0)などを知るためには、 。 –
[email protected]に感謝します。私は理解しようとします。 – Meg