ExecuteAutomation

BDD with Selenium POM Page Navigation and Specflow

In the last post we saw how we can write our code using Page Object Model of Selenium with BDD and Specflow, and in this post we are going to extend the previous topic and start working with Page Navigation of Selenium. In this post we are going to create two feature files and will with two different scenarios like Login and EA form update. Here is how the feature file looks like EA Page Feature Login Feature Please find below the complete video of the above discussion Here is the complete code from the above video Login Page Steps
        IWebDriver currentDriver = null;


        [Given(@"I have navigated to my application")]
        public void GivenIHaveNavigatedToMyApplication()
        {
            Browser.Current.Navigate().GoToUrl(ConfigurationManager.AppSettings["seleniumBaseUrl"]);
            currentDriver = Browser.Current;
            PropertiesCollection.currentPage = new LoginPage();
        }

        [Given(@"I typed the admin and admin")]
        public void GivenITypedTheAdminAndAdmin(string userName, string password)
        {
            PropertiesCollection.currentPage.As().Login(userName, password);
        }

        [When(@"I click login button")]
        public void WhenIClickLoginButton()
        {
            PropertiesCollection.currentPage = PropertiesCollection.currentPage.As().ClickLogin();
        }

        [Then(@"I should see the EA page")]
        public void ThenIShouldSeeTheEAPage()
        {
            PropertiesCollection.currentPage.As().IsLoggedIn();
        }
EA Page Steps
   class EASteps
    {

        [Given(@"I typed the UserName and Password")]
        public void GivenITypedTheUserNameAndPassword(Table table)
        {
           dynamic values = table.CreateDynamicInstance();
           PropertiesCollection.currentPage.As().Login(values.UserName, values.Password);
        }

        [When(@"I enter all the details to EA Page and Click Save")]
        public void WhenIEnterAllTheDetailsToEAPageAndClickSave(Table table)
        {
            dynamic values = table.CreateDynamicInstance();

            PropertiesCollection.currentPage.As().FillDetails(values.Initial, values.FirstName, values.MiddleName);
        }

        [Then(@"I should see my details saved")]
        public void ThenIShouldSeeMyDetailsSaved(Table table)
        {
            dynamic values = table.CreateDynamicInstance();
            PropertiesCollection.currentPage.As().GetFilledDetails(values.Initial, values.FirstName, values.MiddleName);
        }
    }
Thanks for watching the video and reading the post !!! Please leave your comments and let me know if there is anything need to be improved in this post. Thanks, Karthik KK