更新:あなたが最初の直接の前に
attach_file('file[picture]', 'path/to/file.png', make_visible: true)
を試すことができます2.12+使用してその場合カピバラ2.12はattach_file
へmake_visible
オプションを追加しましたexecute_script
自分で
ファイル入力は、スタイリングの理由から隠されることが多く、対話のためにシステムモーダルを使用するため、特別なケースです。カピバラは、ファイル入力、通常の練習は彼らが見えるようにし、その後でそれらを埋めるためにexecute_script
を使用することであるためので、ユーザーは一般的に、彼らと対話することはできませんので、それはハードページに隠されたフィールドに入力します。
execute_script("$('input[name=\"file[picture]\"]').removeClass('hidden')") # assumes you have jQuery available - if not change to valid JS for your environment
attach_file('file[picture]', 'path/to/file.png') # takes id, name or label text of field not a random selector
make_visible:true +1 –