[英]How to take a screenshot of a full browser page and its elements using selenium-webdriver/capybara in Ruby?
[英]Can anyone suggest how to take screenshot of full webpage using ruby selenium?
我想使用 ruby selenium 在 chrome 瀏覽器中捕獲完整的網頁截圖。 我正在使用 Rspec 測試框架。
save_screenshot<\/code>方法僅捕獲可見區域的屏幕截圖。
我已經通過以下鏈接,
如何在 Ruby 中使用 selenium-webdriver\/capybara 截取完整的瀏覽器頁面及其元素?<\/a>
但我不想使用窗口大小調整或 watir gem。 有沒有其他方法或寶石來實現相同的目標。
1)您可以使用https://github.com/samnissen/watir-screenshot-stitch在哪里
2)或為您的操作系統使用本機工具 - https://paulhammond.org/webkit2png
在代碼中看起來像這樣webkit2png https://stackoverflow.com/questions/60728482/can-anyone-suggest-how-to-take-screenshot-of-full-webpage-using-ruby-selenium
在哪里:
- 主命令 - webkit2png
- 鏈接頁面 - all else
這是個老問題,但發布這個並沒有什么壞處。 使用Scrot截屏,稍后制作gif。 由於 OP 只想要屏幕截圖,因此命令將是:
require 'screenscrot'
@screen = ScreenScrot.new
@screen.capture(:all)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.