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 7582583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:28:14+00:00 2026-05-30T18:28:14+00:00

this is weird to me, it’s got to be something obvious but when using

  • 0

this is weird to me, it’s got to be something obvious but when using Selenium who knows…I haven’t used Selenium until now.

But here is just basic code I think and I think it’s just a syntax/OOP issue but not sure what.

Lets say I have a base class that has a driver property and a method where I’m getting the problem happening later on:

public Abstract BaseTest
{
    protected IWebTestDriver TestDriver {get; set;}

    ...more code

    protected void WaitForGridToRender(double seconds)
    {
        TestDriver.Wait(TimeSpan.FromSeconds(seconds));
    }  
}

I then have a test class called MyTests.cs that inherits BaseTest and in it an NUnit test:

[TestFixture]
public class MyTests : BaseTest
{
        [Test]
        public void SomeTab_WhenClicked_ShowsSomething()
        {
             SomeLandingPage someLandingPage = new SomeLandingPage(TestDriver);

             mainLandingPage.NavigateToTheMainPage();

             ... rest of code
        }

        .. other test methods
}

And I have a 3rd class that serves as a “PageObject” that allows me to just reuse certain elements on the page, get at some things (more DRY) than have these same common methods repeated throughout my test methods:

public class MyPageObject : BaseWebTest
{
        public void NavigateToTheMainPage()
        {
             // wait for the user to log in
             WaitForGridToRender(5);
        }
}

Now here’s where my problem is and how things are being called:

1) The Base class is first initialized…meaning that TestDriver’s instance is created and set to the TestDriver property so we can use it in subclasses

2) Eventually some code in another class that I did not mention here is called from the Base Class which just sends some calls to opens up FireFox, does some stuff…nothing special here

3) Eventually control goes to my test method and eventually hits the SomeTab_WhenClicked_ShowsSomething() method which then calls the MyPageObject.NavigateToTheMainPage() method.

The NavigateToTheMainPage() tries to call the BaseTest method called WaitForGridToRender and control eventually gets there.

Now the problem is, up till when WaitForGridToRender is called from within MyPageObject, that BaseTest.TestDriver instance has been there and accessible to both my test class and my PageObject class.

But when I finally debug and get to this line in WaitForGridToRender:

 TestDriver.Wait(seconds);

Now for some reason, I get a null ref on TestDriver…the reference instance for that property is gone!

No idea why which is why I’m posting this cause I’m stuck as to why this might happen.

  • 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-30T18:28:15+00:00Added an answer on May 30, 2026 at 6:28 pm

    1) The Base class is first initialized…meaning that TestDriver’s instance is created and set to the TestDriver property so we can use it in subclasses

    This code

    protected IWebTestDriver TestDriver {get; set;}
    

    declares a protected property of type IWebTestDriver named TestDriver.

    Unless you’re setting TestDriver to something in a constructor or method not shown here, the backing variable for TestDriver contains a null reference.

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

Sidebar

Related Questions

Got this weird issue with Using jQuery 1.6.0 issue. I am trying to append
I ran into this weird bug or something in android's 4.0.1 Ice Cream Sandwitch,
You may find this weird, actually very weird, but is the following possible? just
I got this weird error when I was trying to compile matlab to C++
I've got this weird problem - I'm calling ChangeServiceConfig on a newly installed service
I came across this weird C++ program. #include <iostream> using namespace std; int main()
I have this weird issue in Magento when someone places an order using PayPal
I am having this weird problem where everything seems to work as expected but
I have this weird issue with special characters. In JSP, I am using field
I've got this weird error when i try to generate either the filters or

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.