I am having trouble seeing the methods from one of the class. I have created a MobileLoginPage class and I want to click the Menu button. I noticed there is already a method defined to click the Menu button from a class called MobileNavigationPage. The method is called ClickMenuNavigation
As this method already exists I should be able to call it from my MobileLoginPage class. Avoid duplicating code. I am not able to call it, when i write the code MobileNavigationLogin. no methods show up. I even tried to call the locator element by defining a method (getMenuNavigationElement) to return the locator. I cannot see this locator from LoginPage class.
The class has been instantiated in the BasePage class, I do not know why I cannot see it's methods.
My code snippet is:
The BasePage is and all of our classes are instantiated here:
public class BasePage : SpecflowBaseTest
{
internal MobileNavigationPage MobileNavigationPage => new
MobileNavigationPage(Browser);
internal MobileLoginPage MobileLoginPage => new
MobileLoginPage(Browser);
}
The MobileNavigationPage is:
public void MobilenavigationPage : BasePage
{
#region Elements
[FindsBy(How = How.Id, Using = "MobileMenuNavigation")]
private IWebElement MenuButton {get; set;}
#endregion
#region Actions
private void ClickMenuNavigation()
{
Actions.Click.Element(Browser, MenuButton);
}
private IWebElement getMenuNavigationElement()
{
return MenuButton;
}
#endregion
}
The MobileLoginPage is:
public class MobileLoginPage : BasePage
{
# region Actions
public void ClickBrandFromMenuNavigation{}
{
// I want to call ClickMenuNavigation() from here
}
#endregion
}
From LoginPage class how do I call the method which is defined in MobileNavigationPage?