Taking Screenshots using Selenium Web Driver
How to take Screenshots using Selenium Web Driver ? I am using a Grid Configuration having 2 nodes. I need to take screen shots at every defined interval from both nodes.
Please do not specify the way to take screenshot. I want the Test cases not to call a common method every time to take screenshot. Rather another thread should be always active which can take screenshots at an interval.
You will have to have multiple threads, and pass the driver instances to both of them, and one thread will perform the test, while another thread will sit on a timer, taking a screenshot every X seconds.
I don't recommend this, however, here's why:
It's probably going to throw a lot errors. What happens if you try to take a screenshot while the driver is booting up, or going to a page? It may not even have the capability to take a screenshot while doing simple things.
Unless you are going to be taking screenshots every half second, and putting it into a video, (which is going to slow down your test), the majority of the screenshots are not going to be useful, and the useful ones are going to be hard to find in the massive amount of screenshots taken.
If you want to include another driver, you're going to have to pass it to the thread as well, taking a third screenshot.
So, in conclusion, I ask why you want this...because I would be happy to suggest an alternative solution that will still fit your needs.
链接地址: http://www.djcxy.com/p/67392.html上一篇: 参数在TestNG中传递默认值