我有按钮/链接,点击时会截取屏幕截图。如何自动执行此操作以单击所有页面上的链接以通过脚本截取屏幕截图,以便我可以获取所有屏幕截图。目前使用webshot gem捕获图像。
<%= link_to 'Take Screenshot', capture_image_account_site_path(@account, @site), method: :post, data: { disable_with: 'Processing...', id:'screenshot' } %>
def capture_image
@site = Site.find(params[:id])
@ws = Webshot::Screenshot.instance if @site.primary?
@url = @site.website
@ws_image = @ws.capture strip_url(@site.website), "#{Rails.root}/public/images/screenshots/#{@site.id}.png", width:300, height:180, timeout:3
redirect_to(account_site_url(@account, @site, view: 'active'))
end
考虑创造一个耙子,但我以前从未创造过。提前致谢。