Reputation: 1570
Following this SO post I was able to take screenshots but they turned out to be just white. I tried couple of workarounds with no avail
Code
Screenshot ss=((ITakesScreenshot)driver).GetScreenshot();
ss.SaveAsFile("test.png", System.Drawing.Imaging.ImageFormat.Png);
What should be my next steps. I am using C# 4.0
Upvotes: 3
Views: 4005
Reputation: 1570
My mistake, I was not using the selenium API correctly. I doubt any one would again do the same mistake again but here is the fix. I did the first call
Screenshot ss=((ITakesScreenshot)driver).GetScreenshot();
in a constructor and second savefile at the place I want to create the screenshot
ss.SaveAsFile("test.png", System.Drawing.Imaging.ImageFormat.Png);
They both should be combined at one place.
Upvotes: 2
Reputation: 26971
Perhaps you are taking a screenshot of WebGL object? Traditional screenshots may not work in this case.
Upvotes: 0