New to Telerik Test Studio? Download free 30-day trial

Pages Not Defined

Problem

When I execute my test in the Standalone version, or build my test project in the VS plugin, I receive one of the following errors:

  • Type 'Pages' is not defined
  • The type or namespace name 'Pages' could not be found

Cause

The coded files need to use the namespace as the one set on project level in the Project settings under the Script tab. The issue usually appears if the coded files are copied within a new project and not inserted through the Project Explorer options to add existing test, or coded file.

The code-behind file for a test in project with name TestProj2 looks like this:


// Starting with a list of using statements which may vary 
// and therefore are not listed here

namespace TestProj2 // This is the namespace set in the project settings
{

    // This is the class name which matches the test name in which the coded step was created
    public class KendoReactCombobox : BaseWebAiiTest 
    {
        #region [ Dynamic Pages Reference ]

        private Pages _pages;

        /// <summary>
        /// Gets the Pages object that has references
        /// to all the elements, frames or regions
        /// in this project.
        /// </summary>
        public Pages Pages
        {
            get
            {
                if (_pages == null)
                {
                    _pages = new Pages(Manager.Current);
                }
                return _pages;
            }
        }

        #endregion

        // Add your test methods here...


    }

}

Solution

In this article