質問

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:

  1. 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.

  2. 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.

  3. 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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top