如何在selenium中使用setCaptureScreenShotOnFailure(true)
我有一个测试类,我添加了一个包含 方法 setCaptureScreenShotOnFailure(true) 有一个断言语句在此测试中失败 但即使没有捕获任何屏幕截图(我检查了 硒服务器目录) 任何人都可以解释如何使用此方法 我知道我不能在我的设置方法中使用它,我只能使用 在单独的测试班中 正确吗?
I have a test class to which i have added a constructor containing a
method setCaptureScreenShotOnFailure(true)
There is an assert statement which gets failed in this test
But even though there is no screenshot being captured ( i checked the
selenium server directory)
Can anyone explain how to work with this method in
I understand i cannot use this in my setup method and i can only use
in the individual test classes
Is it correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这仅适用于个人班级。但是,如果您想要更有效地使用,那么您可以实现 testng,然后创建一个扩展到 testlistener 的屏幕截图类。这样您就可以在测试通过或失败时捕获屏幕截图。参考Selenium Testng Screenshot Listener
Yes this is only for individual class. However, if you want more effective use then you can implement testng then create a screenshot class which extends to testlistener. So that you can capture screenshot during pass or faliure of tests. refer Selenium Testng Screenshot Listener