How do I capture the screen of the browser I am testing ? eg during exception...
Here is what I wrote one and off over the years. This captures the full Windows screen not just the browser. This is two functions as of now. One grabs the screen and saves it as Image with some date and time. The second function deletes it.
This returns the file path that was created. (I was using this so I could attach the file to an e-mail)
I don't know if you need both of these Drawing ones.
'Just so you know this only Grabs the screen shot of the Main screen (not both screens)
Public Sub grabScreenShot(Optional ByRef file As String = "")
Dim captureFilePath As String
captureFilePath = "C:\Image-" & Format(Now, "MMddhhmmss") & ".jpg"
Dim bmpSS As Bitmap
Dim gfxSS As Graphics
bmpSS = New System.Drawing.Bitmap(Screen.PrimaryScreen.Bounds. Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb)
gfxSS = System.Drawing.Graphics.FromImage(bmpSS)
gfxSS.CopyFromScreen(Screen.PrimaryScreen.Bounds.X , Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy)
Dim saveDialog As New SaveFileDialog
'saveDialog.Filter = "JPeg Image|*.jpg"
'saveDialog.Title = "Save Image as"
saveDialog.FileName = captureFilePath
file = captureFilePath
Public Sub delScreenGrab(file As String)
'Delete the Image that was created
Console.WriteLine("Delete Screen Shot " & file)