In this series, we will discuss working with Selenium in C# along with Visual Studio IDE. Selenium with C# is yet another language binding of Selenium WebDriver, but most popularly used like Java. As many people started to work with Selenium and are very focused on one specific language like C#, this series is aimed for those who wants to learn automating application with Selenium in C#. Here is the complete series of articles discussed related to Selenium automation with C#


  1. Themba says:

    I am new to automation and need to understand each and every line that is not clear and easily understood.

    what does the below line mean?

    InternetExplorerDriver driver = new InternetExplorerDriver

  2. Srinivas Reddy says:

    I need a training on selenium with C#. Let me know weather your providing any online training. Please provide the information as soon as possible. Our project is going to automate with selenium with C#

  3. Shilpa says:

    Hi Karthik,
    I wanted to know does Nunit attributes.. How do we execute the methods dependent on other methods, as in like in testng we have depends on annotations.. How about nunit

  4. Lakshmi says:

    Hi Karthik

    I went through your videos on Selenium Webdriver using C#. It is very good. Thank you very much. I am basically a Test Automation engineer, but used Java. The present employer is a Visual Studio C# platform. So I am trying to convert the Java webdriver framework (Keyword Driven framework) into C#. I am stuck at the point where I have to write an equivalent C# for file. My statements in that would be for now (and later will keep increasing key=value pair):

    How can I accomplish this in C# ? Google gives a lot of answers, but since I am new to C#, unable to see which is the best. Will you please be able to guide me on this ? I created a SpecialSettings.Properties file in the Property folder of the C# project, but do not how to use it.

    Thanks & Regards

    • Karthik kk says:

      Properties files does not exist in C#, rather the more straight-forward way is to go with App.config file and create something like this

      Then in the code import the configurationmanger namespace and write the code something like this to get the of key from config

      Note: All the above code I written with using IDE, hence may have some syntax error or typo. But this is the core idea.

      Karthik KK

  5. Chandan says:

    Karthik your videos are really very helpful to start with. I want to know how to find the line number of any div element in Selenium.

  6. Akash says:

    HI Karthik,
    Do you take any online classes for C# with selenium.
    Please let me know in case u take it.
    I am willing to take classes asap.


  7. anonymous says:

    Hi karthik pls post all videos of selenium with # from scratch to framework implementation pls…it would be helpful for lot of us who are stuck…

  8. Dennis Minard says:

    I’ve reviewed all your excellent videos on Selenium, Coded UI and using the Selenium add-in in VS so that you can use POM. I am very frustrated about one thing and hope you can help/enlighten me. I typically turn on the verbose logging in CUIT (setting EqtTraceLevel to a value of 4 in the App.config). However, once I changed my application over from the hand-coding technique you showed, to using POM techniques, the verbose feedback is no longer showing, except if a failed line is hit. I have not discovered any way to get the line-by-line passes and fails feedback that I used to have. As I said, for tests where I am not using POM, I have the feedback. With POM, no feedback, except for a failed line.

  9. Nitesh singhal says:

    Hi Karthik,
    i am trying to use latest selenium version 2.47.0 with VS2008 and with first program i am getting following exception:

    Unhandled Exception: System.MissingMethodException: Method not found: ‘Boolean System.Runtime.Serialization.DataContractAttribute.get_IsReference()’. at Newtonsoft.Json.Serialization.DefaultContractResolver.InitializeContract(JsonContract contract)

    do you have any idea what could be missing.

    Thanks in advance.

  10. Kumar says:

    Hi Karthik,

    I got below error message after building project of Selenium ,C# , Specflow,POM example.Please can you help me on this?
    Generation error: SpecFlow configuration error -> The element may only appear once in this section.


  11. Thirupathiareddy says:

    hi karthik,
    im new to automation. pls let me know how to handle popup in visualstudio using selenium


  12. Manjunath says:

    Hi Karthik,

    Your doing Brilliant Job. This site and Videos helps a lot to beginners. I have one doubt, I want know how to write automation code for each test case in Test Case document. Like for Each Test Case we have to write one [Test] method or What is the alternative way.

    Suppose for Login Page, test case is Login with valid data. We will write it in [Test] method. Again login with in valid data, again another [Test].
    If we write like this, For Login page we can write multiple tests[Test] methods. Then How will be the flow. Load url -> execute [Test] -> close browser for each [Test]. I am confused to write multiple tests [Test] and automate a project. Can you take a small example like Login page navigating to Some search page and explain How to automate with multiple tests.


  13. Huy says:

    Hey Karthik. Excellent tutorials! It’s a great help. When a new page loads after clicking on an element, should we always perform a wait?
    Do you have a tutorial or code for this?


  14. Sravan Kumar says:

    Hi Karthik,

    I watched selenium with Java and C# and videos are Excellent. But i want to know more about Exception handling using C# and as well how to use
    different types of wait method.
    If you could provide me the any available videos or examples that will be helpful for me.

    Thanks in advance.

  15. Jay says:

    I want to learn from you, could please tell me how much you will charge and will you be able to teach me over skype etc.

  16. Amita says:

    Hi Karthik,
    Please advise on handling popup in selenium using C# and alongwith that how we can identify element on the popup window.


  17. Ramon says:

    How to add Explicit and Implicit Waits in class “SeleniumSetMethods”? Add “Wait(element)” before Clicks, EnterText, etc.. actions? Thanks

  18. I have multiple feature files for my project and I want to run these feature file according to my way that firstly feature 1 run,and after that feature file 2 will run and then feature file 3 will run in a way.
    How can I do this please?
    Mian Sumair Javed

    • Karthik kk says:

      You cannot order the scenarios of features files or order the feature file itself to execute.

      My advise will be this

      1. Keep each test independent of each other.
      2. If your test seems to be dependent, then try to prefix some values like 1_Login, 2_UserForm etc (Not recommended)

      Karthik KK

  19. Rishi says:

    I want to run my Selenium Test case and Appium Test in parallel? How can I achieve that?
    Below is my sample code:

    class Program
    static IWebDriver driver;
    static DesiredCapabilities dc;

    public static void Main(String[] args)

    if (sel.flag.Equals(true))
    Uri uri;
    dc = new DesiredCapabilities();
    dc.SetCapability(“browserName”, “chrome”);
    dc.SetCapability(“platformName”, “Android”);
    dc.SetCapability(“deviceName”, “Nexus 5”);
    dc.SetCapability(“platformVersion”, “6.0.1”);
    uri = new Uri(“”);
    driver = new RemoteWebDriver(uri, dc, TimeSpan.FromSeconds(120));

    catch (Exception e)
    driver = new ChromeDriver(@”C:\Users\******\Desktop\softwares”);

  20. Rahul D. says:

    Hi Karthik,
    Thank you for starting this portal. Really helpful for developers/testers who want to explore Selenium
    one question – in my case, I have one pivot table in my web report (Qlikview). I want to use Selenium with C# to test my report.
    Basically to compare pivot table data with expected results stored in excel sheet.

    How Can I implement this test case?

  21. Srikanth says:

    HI karthik,
    How can we handle and I want to set wait for pageload to 2 min using c# but I couldn’t and it is taking only 60 seconds(page in my app takes more than 60 sec to load) then Iam getting [timed out after 60 seconds] exception. could you please tell me a way to do that..that would be great.

    thanks in advance..

    • Karthik kk says:

      Hi Srikanth,

      Can you implicit wait for 2 min using Selenium.

      If you are getting timeout in application because of its response, then you have to handle only in application code, not from your automation.


      • Srikanth says:

        Hi karthik ,
        below is the code that i have used for both page load as well as implicit wait, but this is not working for me:-(
        — one more thing is , as i have mentioned that page load in my app takes more than 1 min,I as automation tester has to perform action according to that.but I am getting following exception[The HTTP request to the remote WebDriver server for URL http://localhost:65482/session/7b40c5eb7d22604f9d6a9807bac5f654/element timed out after 60 seconds. —> System.Net.WebException: The operation has timed out]

  22. Srikanth says:

    Hi karthik,
    how to wait for clicking on an element(button) even though element is visible and enabled . but element is blocked for some time[time is not constant] by some message[Please Wait] .please provide a solution ASAP.
    Thanks ,

  23. Ravi says:

    Hi Karthik,
    I have gone through most of the videos regarding Selenium with C#.I tried to implement the Pagination using Page object model for one of the website.The page is getting redirected to the website on a button click and i am getting the error that unable to find the Id when i run test and when i tried to debug the same code i am not getting any error and the test is getting executed successfully.

    I tried the sample referring the video posted in youtube by executeautomation.Its working fine in this.
    I like the way you teach selenium and it is very easy to learn and i am expecting other technical videos from you.


  24. Melih says:

    Hi Karthik,
    Thank you for helpful and excellent training videos.
    Could you upload Visual Studio Project files (used in Selenium automation with C# videos).

  25. Shahul says:

    Hi karthick, Is that possible to create Appium testcases in visual studio? now im using appium in eclipse, i feel its very hard.

  26. Rani says:


    I am working on webservices, so to validate response, wanted to connect data base, so started created .dbml file for database.
    but not fully done.

    Do you have any videos on this?


  27. harish says:

    Everything is fine, am happy about your blog. Thanks admin for sharing the unique content, you have done a great job I appreciate your effort.

  28. deepthi says:

    Hello Karthik, Thanks for the awesome videos on Selenium with c#, could you please upload videos on TestNG using visual studio?
    I have seen videos of testNg in eclipse but i want them on visual studio please.

  29. Dimpy Sharma says:

    Hi I loved the videios. Can you please upload your EAEmployee project so that I could try and test? Many thanks!

  30. Roshan says:

    The Author had done a great job! He has given information about Selenium in C# along with Visual Studio IDE. Selenium is one of the leading software testing tools in the current industry and it provides a record/playback tool for authoring tests without learning a test scripting language.

  31. Rani says:


    Looking for some kind of documentation , how to map selenium driver scripts with manual test cases in MTM.


Leave a Reply

Your email address will not be published. Required fields are marked *