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

  • Home
  • SEARCH
  • 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 6706169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:29:19+00:00 2026-05-26T07:29:19+00:00

When I am writing this piece of code it works fine using System; using

  • 0

When I am writing this piece of code it works fine

using System;
using WatiN.Core;
using MbUnit.Framework;
using Gallio.Framework;
using System.Text.RegularExpressions;
using System.Collections;
using System.IO;
using System.Drawing;
using Gallio.Model;

namespace DialogHandlerTestWithWatin
{
[TestFixture]
class Program
{
    //This is WatiN - create IE instance
    public static IE ie = new IE();
    [SetUp]
    public void DoTestSetup()
    {
        IE.Settings.WaitForCompleteTimeOut = 60;
    }
    [TearDown]
    public static void TestNavigateToMedappz()
    {
        if (ie != null)
        {
            if (TestContext.CurrentContext.Outcome == TestOutcome.Failed)
            {
                Assert.Fail("Unable to navigate to the medappz application");
                ie.Close();
                ie.Dispose();
                ie = null;
            }
        }
    }


    //This funcn navigate us to the Medappz Application
    [Test]
    public static void NavigateToMedappz()
    {
        using (TestLog.BeginSection("Go to Medappz"))
        {
            Assert.IsNotNull(ie);
            ie.GoTo("http://192.168.10.82/Sage/");
            ie.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
        }
        //This is NUnit - check that ie instance is not null
        Assert.IsNotNull(ie, "Error creating IE instance.");
        Assert.AreEqual("Login Page", ie.Title);

    }

But when I add another test method in this code as

    [TearDown]
    public static void TestLoginToMedappz()
    {
        if (ie != null)
        {
            if (TestContext.CurrentContext.Outcome == TestOutcome.Failed)
            {
                Assert.Fail("Unable to Login");
            }
        }
    }
    [Test]
    public static void LoginToMedappz()
    {
        using (TestLog.BeginSection("Login to Medappz"))
        {
            TextField UserName = ie.TextField(Find.ByName("txtUserName"));
            UserName.TypeText("<username>");
            TextField Password = ie.TextField(Find.ByName("txtPassword"));
            Assert.IsTrue(UserName.Exists, "UserName Textbox does not exist");
            Assert.IsTrue(Password.Exists, "Password Textbox does not exist");
            Password.TypeText("<password>");
            Button btnLogin = ie.Button(Find.ByName("btnLogin"));
            Assert.IsTrue(btnLogin.Exists, "btnLogin button does not exist");
            btnLogin.Blur();
            btnLogin.Click();
        }
    }

Then the test started failing, only a blank IE window opens up and after few seconds the first test method is executed but the second method doesn’t gets executed.The Gallio test report says

Root
110
Results: 2 run, 1 passed, 1 failed, 0 inconclusive, 0 skipped
Duration: 44.042s
Assertions: 3
WatiN.Core.Exceptions.ElementNotFoundException: Could not find INPUT (text password textarea hidden) or TEXTAREA element tag matching criteria: Attribute ‘name’ with value ‘txtUserName’

  • 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-05-26T07:29:20+00:00Added an answer on May 26, 2026 at 7:29 am

    Are the two tests in the same class? I’ve never seen two teardowns in the same class. Also, if TestNavigateToMedappz is called before LoginToMedappz then your ie variable will have already been disposed. How about you have just one teardown, then at the start of LoginToMedappz you call NavigateToMedappz?

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

Sidebar

Related Questions

I'm writing a piece of code to encrypt a text using symmetric encryption. But
I am writing a piece of code which will extract words from running text.
I'm using this piece of code i found from a tutorial to enable Ajax
I am having problems writing a piece of code for android. I am using
I just found myself writing a piece of code that looks like this: def
I'm writing a jQuery plug-in so I can reuse this code in many places
I'm writing a piece of code that requires the DOM of a website to
I am writing a piece of code that to work would require an extensive
I' writing a piece of code that will integrate with TripIt. In my TripIt
I have a piece of C++ code which reads out the text of a

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.