C# won't let me "see" an object in the project

  • Thread starter Thread starter Tom Ruby
  • Start date Start date
T

Tom Ruby

Guest
public static Page mtWizardsMenu = new Page("Wizards", MainMenu.MainMenuPage.MainMenuIcons.wizardsIcon, mtMainMenu);

public static Page mtDeviceSettings = new Page("Device Settings", Settings.SettingsPage.deviceSettingsText, mtSettingsMenu);

C# is happy with the first line of code referencing MainMenu.MainMenuPage.MainMenuIcons.wizardsIcon, but not the second line where it references Settings.SettingsPage.deviceSettingsText, saying "The name Settings does not exist in the current context."

I tried putting "using Settings;" but it's not happy with that either.

"Settings" is a name space with a class in SettingsPages.cs:

using System;
using OpenQA.Selenium;

namespace Settings
{
public class SettingsPage
{


//!Locators for the the new sub element menus
public static readonly By deviceSettings = By.Id("deviceSettings");
public static readonly By deviceSettingsText = By.XPath("//*[@id='deviceSettingsSubElement'][contains(text(),'Device Settings')]");
public static readonly By deviceSettingsValue = By.Id("deviceSettings_SubElementValue");

bla bla bla
}
}


This looks to me like the MainMenu namespace in MainMenuPages.cs:

using System;
using OpenQA.Selenium;

namespace MainMenu
{
public class MainMenuPage
{
//The Main Menu Page class models the functionality on the Main Menu HTML page. The class stores the elements of interest (state) in variables and any actions that can be performed with those elements (behavior) in methods.

public class MainMenuIcons
{
bla bla bla
public static readonly By informationIcon = By.Id("informationMenuItem");
public static readonly By wizardsIcon = By.Id("wizardsMenuItem");

//public static readonly By helpIcon = By.Id("ngcHelpItem");
}

}

}


Other parts of this pretty massive solution use this Settings page, so it looks to me like it should work. Anybody see my blunder?


(Funny how a line of code can hold you up all day.)

Continue reading...
 
Back
Top