[英]Can anyone suggest how to take screenshot of full webpage using ruby selenium?
I want to capture full webpage screenshot in chrome browser using ruby selenium.我想使用 ruby selenium 在 chrome 浏览器中捕获完整的网页截图。 I am using Rspec testing framework.我正在使用 Rspec 测试框架。 save_screenshot<\/code> method captures screenshot only for visible area.
save_screenshot<\/code>方法仅捕获可见区域的屏幕截图。
I have gone through the following link,我已经通过以下链接,
How to take a screenshot of a full browser page and its elements using selenium-webdriver\/capybara in Ruby?<\/a> 如何在 Ruby 中使用 selenium-webdriver\/capybara 截取完整的浏览器页面及其元素?<\/a>
"
1) You can use https://github.com/samnissen/watir-screenshot-stitch where 1)您可以使用https://github.com/samnissen/watir-screenshot-stitch在哪里
2) or use native instrument for your OS - https://paulhammond.org/webkit2png 2)或为您的操作系统使用本机工具 - https://paulhammond.org/webkit2png
In code will look like this在代码中看起来像这样webkit2png https://stackoverflow.com/questions/60728482/can-anyone-suggest-how-to-take-screenshot-of-full-webpage-using-ruby-selenium
where:在哪里:
- main command - webkit2png
- 主命令 - webkit2png
- link page - all else
- 链接页面 - all else
It's old question, but it doesn't hurt to post this.这是个老问题,但发布这个并没有什么坏处。 Use Scrot to take screenshot, and later make gif.使用Scrot截屏,稍后制作gif。 Since OP only want screenshots, command would be:由于 OP 只想要屏幕截图,因此命令将是:
require 'screenscrot'
@screen = ScreenScrot.new
@screen.capture(:all)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.