How can we take screenshots of tests in Selenium 2 using C#

0 votes
I need to take screenshots of my functional tests. As of now I'm using Selenium 2 with C# bindings. I pretty much want to take a screenshot at the end of the test to make sure the desired page is displayed. Are there any external tools I can use with my C# code for taking a screenshot? I couldn't find any way to do in Selenium 2
Mar 23, 2018 in Selenium by nitinrawat895
• 9,670 points
117 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

We can take screenshots using below function calls: 

driver = new FireFoxDriver(); // Should work in other Browser Driver
driver.Navigate().GoToUrl("Your_URL"); 
Screenshot myscreen = ((ITakesScreenshot)webDriver).GetScreenshot(); 
myscreen.SaveAsFile("filename", ScreenshotImageFormat.Png); 

This should work...do let me know if it works.

answered Mar 23, 2018 by nsv999
• 5,050 points

Related Questions In Selenium

+2 votes
1 answer

How can we handle authentication popup in Selenium WebDriver using Java

The Alert Method, authenticateUsing() lets us skip ...READ MORE

answered Apr 18, 2018 in Selenium by king_kenny
• 3,590 points
3,925 views
0 votes
1 answer
0 votes
1 answer

How can I implement Selenium using C#?

Reference https://www.seleniumhq.org/docs/03_webdriver.jsp#the-5-minute-getting-started-guide using OpenQA.Selenium.Firefox; using OpenQA.Selenium; class GoogleSuggest { ...READ MORE

answered Apr 9, 2018 in Selenium by Neville
19 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
164 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
555 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
152 views
0 votes
1 answer

Can we run selenium tests (Firefox) on WebDriver without a GUI?

You can explore options like HTMLUnit Driver ...READ MORE

answered Mar 23, 2018 in Selenium by nsv999
• 5,050 points
171 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.