简体   繁体   English

使用watir扩展元素截图截屏

[英]Take screenshot using watir extension element screenshot

I am using watir web driver, to go to url and fetch screenshot. 我正在使用watir Web驱动程序,转到URL并获取屏幕截图。

I am able to take screenshot for whole page, unable to take particular element. 我能够截取整个页面的屏幕截图,无法截取特定元素。 I tried watir extension element still not able to figure it. 我尝试了watir扩展元素,但仍然无法找到它。

This is my code 这是我的代码

require "watir"
require 'watir/extensions/element/screenshot'
browser = Watir::Browser.new
browser.goto "http://images.morefrom.co.uk/prodmainimg.aspx?pn=7350022730991&man=Multibrackets"
browser.screenshot.save 's.jpg'

I want to take screenshot of particular image in page there is no div, i tried 我想拍摄页面中没有div的特定图像的屏幕截图,我尝试过

browser.body.img.screenshot.save 's.jpg'

`screenshot': wrong number of arguments (0 for 1) (ArgumentError) `screenshot':参数数量错误(0表示1)(ArgumentError)

What should i be doing? 我该怎么办?

我想我找到了

browser.body.img.screenshot("s.jpg")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM