我无法使用Capybara-webkit
or Poltergeist
(它们是无头的)进行此测试,所以我切换到Selenium
.
示例代码:
test 'filepicker upload' do
# in case your default driver is :webkit
Capybara.current_driver = :selenium
# this click_on will trigger filepicker.io plugin
click_on 'Upload'
# waiting for filepicker.io
sleep 5
within_frame 'filepicker_dialog' do
# attach image to filepicker file input and upload...
find('#fileUploadInput', visible: false).set("#{Rails.root}/test/integration/test_image.png")
sleep 5
end
end
从我的调试来看,原始隐私或类似问题存在问题,因为我遇到了错误:
Unsafe JavaScript attempt to access frame with URL