How do I include screenshots of the full page in my serenity report (and not only of the viewport) using ChromeDriver?

孤者浪人 提交于 2019-12-24 01:18:56

问题


I am using serenity in combination with cucumber for automated screen tests and want to include full-page screenshots in my serenity report. The screenshots in the report are normally only a capture of the viewport. Oftentimes however, this doesn't provide enough information as this is only a part of the screen.

I found that the capturing of serenity screenshots is a part of driver implementation. As most drivers conform with the W3C definition of screenshots those drivers only capture the current viewport.

In this discussion I found that this is a common problem for test-automation. Comment 143 mentions this great library for customizing screenshots.

I got this to work in my code, however I would now like to integrate this into the serenity report and this is where I got stuck.

Does anyone know how to replace (or add) the standard screenshot-capturing-part of the serenity using the above library?

I would already be helped a lot if someone could tell me where the screenshot-capturing part of the serenity code is located.. Is it somewhere inside serenity-core?


回答1:


The above mentioned Selenium - Shutterbug library can be used in combination with Serenity-BDD in a PageObject use the following line.

Shutterbug.shootPage(getDriver()).save();

Tip Serenity-BDD fine-tuning screenshots in your living documentation

Through the serenity.properties as shown below:

serenity.take.screenshots.for.tasks=after_each_step
serenity.take.screenshots.for.interactions=for_failure
serenity.take.screenshots.for.questions=after_each_step


来源:https://stackoverflow.com/questions/41567890/how-do-i-include-screenshots-of-the-full-page-in-my-serenity-report-and-not-onl

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