Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8893175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:10:53+00:00 2026-06-14T23:10:53+00:00

I’ve just started using Selenium – currently I’m only interested in IE as it’s

  • 0

I’ve just started using Selenium – currently I’m only interested in IE as it’s an intranet site and not for public consumption. I’m using IEDriverServer.exe to set my browser sessions up, but I’m unsure as to whether I need to recreate it for each test, or if it will maintain atomicity of the browser sessions/tests automatically. I’ve not been able to find any information on this as most of the examples are for a single test rather than a batch of unit tests.

So currently I have

[TestInitialize]
public void SetUp()
{              
   _driver = new InternetExplorerDriver();
}

and

[TestCleanup]
public void TearDown()
{
   _driver.Close();
   _driver.Quit();
}

Is this correct or am I doing extra unnecessary work for each test? Should I just initialise it when it’s declared? If so, how do I manage its lifecycle? I presume I can call .Close() for each test to kill the browser window, but what about .Quit()?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:10:54+00:00Added an answer on June 14, 2026 at 11:10 pm

    I use Selenium with NUnit, but you don’t need to recreate it every time. Since you are using MSTest, I would do something like this:

    [ClassInitialize]
    public void SetUp()
    {              
       _driver = new InternetExplorerDriver();
    }
    
    [ClassCleanup]
    public void TearDown()
    {
       _driver.Close();
       _driver.Quit();
    }
    

    ClassInitialize will call code once per test class initialisation, and ClassCleanup will call code once per test class teardown / dispose.

    Although this is still not guaranteed because the test runner may make several threads of the test:

    http://blogs.msdn.com/b/nnaderi/archive/2007/02/17/explaining-execution-order.aspx

    You must also think about what kind of state you want to tests to start at each time. The most common reason for shutting down and starting a new browser session each time is then you can have a clean slate to work with.

    Sometimes this is unnecessary work, as you’ve pointed out, but what is your tests starting point?

    For me, I have one browser per test class, with a method to sign out of my web application and keep at the login page at the end of each test.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.