[英]Selecting a file when prompt appears to upload a file using Selenium-Webdriver with Ruby
[英]Using Explorer as a file prompt in Ruby
我在ruby中使用CSV庫處理大型CSV文件。 我想最終制作一個可執行文件,該文件將允許用戶在Windows資源管理器中選擇CSV文件,而不是輸入完整的文件路徑。 誰能幫我這個?
#explorer prompt for file or filename
CSV.foreach(returned_pathname) do |row|
#processing
end
我將shoes庫用於我的簡單Ruby GUI需求。
然后您可以執行類似的操作,當然您需要為此添加更多代碼,但這應該可以幫助您入門。
Shoes.app :width => 512, :height => 384, :title => 'My App' do
# Browse for file button
stack(left: 35, top: 90) do
@push = button 'Browse for file'
note = para 'Please select an Excel file', left: 35
@push.click do
filename = ask_open_file
note.replace filename.to_s
end
end
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.