简体   繁体   中英

Take screenshot using watir extension element screenshot

I am using watir web driver, to go to url and fetch screenshot.

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.

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

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

`screenshot': wrong number of arguments (0 for 1) (ArgumentError)

What should i be doing?

我想我找到了

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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