Save screenshot with Watir

女生的网名这么多〃 提交于 2019-12-03 17:29:34

There are several watir gems: watir (drives IE on windows), safariwatir (drives safari on mac), watir-webdriver (drives all popular browsers except safari on all popular operating systems).

You are using safariwatir gem, but you are trying to save screenshot using watir-webdriver's driver.save_screenshot. I would suggest that you take a screen shot with Firefox.

Just install watir-webdriver gem and change

@browser = Watir::Safari.new

to

@browser = Watir::Browser.new :ff

For more information, read free version of my Watir book:

https://github.com/zeljkofilipin/watirbook/downloads

amjad

Try following browser class, it works for me.

Browser::BROWSER.driver.save_screenshot(screenshot)

(reference)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!