public void SellAndVerifyMarketOrderFlow(string instrument, IWebDriver driver, string amountPrice)
        {
            bool flag = false;

            Thread.Sleep(3000);
            CommonFunctionality.SelectDashBoardButton(driver);
            Thread.Sleep(2000);


            string exchangeStringValueFromSite = driver.FindElement(exchangeMenuText).Text;

            Thread.Sleep(3000);

            if (exchangeStringValueFromSite.Equals(exchangeMenuString))
            {
                Assert.True(true, "Verification for exchangeMenu value has been passed.");
                output.WriteLine("Verification for exchangeMenu value has been passed.");
                flag = true;
            }
            else
            {
                Assert.False(false, "Verification for exchangeMenu value has been failed.");
                output.WriteLine("Verification for exchangeMenu value has been failed.");
                flag = false;
            }

            CommonFunctionality.SelectInstrumentFromExchange(instrument, driver);
            UserSetFunctions.Click(driver.FindElement(sellOrderEntryButton));
            UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton));
            UserSetFunctions.EnterText(driver.FindElement(sellAmountTextField), amountPrice);

            Dictionary <string, string> balances = new Dictionary <string, string>();

            if (driver.FindElement(feesText).Enabled&& driver.FindElement(orderTotalText).Enabled&& driver.FindElement(netText).Enabled)
            {
                // Storing balances in Dictionary
                balances = CommonFunctionality.StoreMarketAmountBalances(driver);
                logger.Info("For Sell Order case --> Balances stored successfully.");
                output.WriteLine("For Sell Order case --> Balances stored successfully.");
            }
            else
            {
                logger.Error("For Sell Order case --> Fees or Order Total or Net amount is not present");
                output.WriteLine("For Sell Order case --> Fees or Order Total or Net amount is not present");
            }

            Thread.Sleep(2000);
            UserSetFunctions.Click(driver.FindElement(placeSellOrderButton));
            // This needs to be changed - crate locator class
            CommonFunctionality.FilledOrderTab(driver);
            CommonFunctionality.ScrollingDownVertical(driver);
        }
        public void VerifyAdvanceBuyOrder(string instrument, IWebDriver driver, string orderSize)
        {
            bool flag = false;

            Thread.Sleep(3000);
            CommonFunctionality.SelectDashBoardButton(driver);
            Thread.Sleep(2000);


            string exchangeStringValueFromSite = driver.FindElement(exchangeMenuText).Text;

            Thread.Sleep(3000);

            if (exchangeStringValueFromSite.Equals(exchangeMenuString))
            {
                Assert.True(true, "Verification for exchangeMenu value has been passed.");
                output.WriteLine("Verification for exchangeMenu value has been passed.");
                flag = true;
            }
            else
            {
                Assert.False(false, "Verification for exchangeMenu value has been failed.");
                output.WriteLine("Verification for exchangeMenu value has been failed.");
                flag = false;
            }

            CommonFunctionality.SelectInstrumentFromExchange(instrument, driver);
            UserSetFunctions.Click(driver.FindElement(advanceOrderButton));

            UserSetFunctions.SelectDropdown(driver.FindElement(instrumentList), instrumentValue);
            UserSetFunctions.SelectDropdown(driver.FindElement(orderTypeList), orderTypeValue);

            UserSetFunctions.EnterText(driver.FindElement(ordersizeTextField), orderSize);

            Thread.Sleep(3000);
            //Dictionary<string, string> balances = new Dictionary<string, string>();

            if (driver.FindElement(feesText).Displayed&& driver.FindElement(ordersizeTextField).Displayed)
            {
                // Storing balances in Dictionary
                //balances = CommonFunctionality.StoreMarketAmountBalances(driver);
                logger.Info("Fees and OrderTotal is displaying in the page.");
                output.WriteLine("Fees and OrderTotal is displaying in the page.");
            }
            else
            {
                logger.Error("Fees and OrderTotal is displaying in the page.");
                output.WriteLine("Fees and OrderTotal is displaying in the page.");
            }
            UserSetFunctions.Click(driver.FindElement(placeBuyOrderButton));
        }
        public void StopBuyOrder(string instrument, IWebDriver driver, string buyAmount, string stopPrice)
        {
            CommonFunctionality.SelectDashBoardButton(driver);

            Thread.Sleep(2000);

            CommonFunctionality.SelectInstrumentFromExchange(instrument, driver);

            //Verifying whether Buy Button and Stop Button is present or not.
            if (driver.FindElement(buyOrderEntryButton).Selected&& driver.FindElement(stopOrderTypeButton).Selected)
            {
                logger.Info("For Buy Stop Order case ---> Balances stored successfully.");
                output.WriteLine("For Buy Stop Order case ---> Balances stored successfully.");
            }
            else
            {
                logger.Info("For Buy Stop Order case ---> Balances stored successfully.");
                output.WriteLine("For Buy Stop Order case ---> Balances stored successfully.");
            }


            // Select Stop Buy Order
            UserSetFunctions.Click(driver.FindElement(stopOrderTypeButton));
            UserSetFunctions.EnterText(driver.FindElement(buyAmountTextField), buyAmount);
            UserSetFunctions.EnterText(driver.FindElement(stopPriceTextField), stopPrice);

            // Verify Market Price, Fees and Order Total
            Dictionary <string, string> balances = new Dictionary <string, string>();

            if (driver.FindElement(feesText).Enabled&& driver.FindElement(orderTotalText).Enabled&& driver.FindElement(marketPriceText).Enabled)
            {
                // Storing balances in Dictionary
                balances = CommonFunctionality.StoreMarketAmountBalances(driver);
                logger.Info("For Buy Stop Order case ---> Balances stored successfully.");
                output.WriteLine("For Buy Stop Order case ---> Balances stored successfully.");
            }
            else
            {
                logger.Error("For Buy stop Order case ---> Market or Order Total or Net amount is not present");
                output.WriteLine("For Buy stop Order case ---> Market or Order Total or Net amount is not present");
            }

            // Place Buy Order
            UserSetFunctions.Click(driver.FindElement(placeBuyOrderButton));

            // Verify Success message

            // Verify entry in Order Book
            // Verify entry Open orders tab
        }
        public void BuyAndVerifyMarketOrderFlow(string instrument, IWebDriver driver, string amountEntered)
        {
            Thread.Sleep(3000);

            // This needs to be changed - crate locator class
            CommonFunctionality.SelectDashBoardButton(driver);

            Thread.Sleep(2000);

            CommonFunctionality.SelectInstrumentFromExchange(instrument, driver);

            UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton));
            UserSetFunctions.EnterText(driver.FindElement(buyAmountTextField), amountEntered);
            Thread.Sleep(2000);

            Dictionary <string, string> balances = new Dictionary <string, string>();


            if (driver.FindElement(feesText).Enabled&& driver.FindElement(orderTotalText).Enabled&& driver.FindElement(netText).Enabled)
            {
                // Storing balances in Dictionary
                balances = CommonFunctionality.StoreMarketAmountBalances(driver);
                logger.Info("For Buy Order case ---> Balances stored successfully.");
                output.WriteLine("For Buy Order case ---> Balances stored successfully.");
            }
            else
            {
                logger.Error("For Buy Order case ---> Fees or Order Total or Net amount is not present");
                output.WriteLine("For Buy Order case ---> Fees or Order Total or Net amount is not present");
            }

            // Place Buy Order
            UserSetFunctions.Click(driver.FindElement(placeBuyOrderButton));

            // Verify the balances stored
            foreach (KeyValuePair <string, string> amount in balances)
            {
                output.WriteLine("Key: {0}, Value: {1}", amount.Key, amount.Value);
            }

            Thread.Sleep(2000);
            // This needs to be changed - crate locator class
            CommonFunctionality.FilledOrderTab(driver);
            CommonFunctionality.ScrollingDownVertical(driver);
        }
        public void AdvanceOrdersButton(string instrument, IWebDriver driver)
        {
            bool   flag = false;
            string exchangeStringValueFromSite = driver.FindElement(exchangeMenuText).Text;

            Thread.Sleep(3000);

            if (exchangeStringValueFromSite.Equals(exchangeMenuString))
            {
                Assert.True(true, "Verification for exchangeMenu value has been passed.");
                output.WriteLine("Verification for exchangeMenu value has been passed.");
                flag = true;
            }
            else
            {
                Assert.False(false, "Verification for exchangeMenu value has been failed.");
                output.WriteLine("Verification for exchangeMenu value has been failed.");
                flag = false;
            }

            CommonFunctionality.SelectDashBoardButton(driver);
            CommonFunctionality.SelectInstrumentFromExchange(instrument, driver);
            UserSetFunctions.Click(driver.FindElement(advanceOrderButton));
            UserSetFunctions.Click(driver.FindElement(buyButton));

            Thread.Sleep(2000);

            if (driver.FindElement(buyButton).Selected)
            {
                Assert.True(true, "Buy Button clicked in Advance Order section.");
                output.WriteLine("Buy Button clicked in Advance Order section.");
            }

            else
            {
                Assert.True(true, "Buy Button isn't clicked in Advance Order section.");
                output.WriteLine("Buy Button isn't clicked in Advance Order section.");
            }
            Thread.Sleep(2000);
        }
        public bool VerifyingPersistantAmount(string amountEntered)
        {
            bool flag = false;

            CommonFunctionality.SelectDashBoardButton(driver);
            CommonFunctionality.NavigateToExchange(driver);
            Thread.Sleep(3000);
            string exchangeStringValueFromSite = driver.FindElement(exchangeMenuText).Text;

            Thread.Sleep(3000);

            if (exchangeStringValueFromSite.Equals(exchangeMenuString))
            {
                Assert.True(true, "Verification for exchangeMenu value has been passed.");
                output.WriteLine("Verification for exchangeMenu value has been passed.");
                flag = true;
            }
            else
            {
                Assert.False(false, "Verification for exchangeMenu value has been failed.");
                output.WriteLine("Verification for exchangeMenu value has been failed.");
                flag = false;
            }

            UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton));
            UserSetFunctions.EnterText(driver.FindElement(buyAmountTextField), amountEntered);
            UserSetFunctions.Click(driver.FindElement(limitOrderTypeButton));
            UserSetFunctions.Click(driver.FindElement(stopOrderTypeButton));
            UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton));

            Thread.Sleep(2000);
            string amountPersisted = driver.FindElement(buyAmountTextField).GetAttribute("value");

            output.WriteLine("Amount Persisted - > " + amountPersisted);
            if (amountEntered.Equals(amountPersisted))
            {
                Assert.True(true, "Test case has been passed for Buy Market Order Type.");
                output.WriteLine("Test case has been passed for Buy Market Order Type.");
                flag = true;
            }
            else
            {
                Assert.False(false, "Test case has been failed for Buy Market Order Type.");
                output.WriteLine("Test case has been failed for Buy Market Order Type.");
                flag = false;
            }

            UserSetFunctions.Click(driver.FindElement(sellOrderEntryButton));
            UserSetFunctions.Click(driver.FindElement(marketOrderTypeButton));
            UserSetFunctions.Click(driver.FindElement(sellAmountTextField));
            UserSetFunctions.Click(driver.FindElement(limitOrderTypeButton));
            UserSetFunctions.Click(driver.FindElement(stopOrderTypeButton));
            Thread.Sleep(2000);

            output.WriteLine("Amount Persisted - > " + amountPersisted);
            if (amountEntered.Equals(amountPersisted))
            {
                Assert.True(true, "Test case has been passed for Sell Market Order Type.");
                output.WriteLine("Test case has been passed for Sell Market Order Type.");
                flag = true;
            }
            else
            {
                Assert.False(false, "Test case has been failed for Sell Market Order Type.");
                output.WriteLine("Test case has been failed for Sell Market Order Type.");
                flag = false;
            }
            CommonFunctionality.LogOut(driver);
            Thread.Sleep(4000);
            driver.Close();
            return(flag);
        }