AutomationUsingSeleniumTest.SeleniumTest.TestCurrencyConvertorWithDDT C# (CSharp) Method

TestCurrencyConvertorWithDDT() private method

private TestCurrencyConvertorWithDDT ( ) : void
return void
        public void TestCurrencyConvertorWithDDT()
        {
            //Read your first country currency name
            var convertVal = TestContext.DataRow["FirstCountryByText"].ToString();
               //Read your second contry currency
            var inToVal = TestContext.DataRow["SecondCountryByText"].ToString();
               //Read Expected value from data source
            var expectedValue = TestContext.DataRow["ExpectedValue"].ToString();
               //Goto the Target website
            WebDriver.Navigate().GoToUrl("http://www.x-rates.com/calculator.html");
            var setValueConvert = WebDriver.FindElement(By.Name("from"));
            var setValueInto = WebDriver.FindElement(By.Name("to"));
            var calculateButton = WebDriver.FindElement(By.Name("Calculate"));
            var outPutvalue = WebDriver.FindElement(By.Name("outV"));

            var selectConvertItem=new SelectElement(setValueConvert);
            var selectIntoItem = new SelectElement(setValueInto);

            selectConvertItem.SelectByText(convertVal);
            selectIntoItem.SelectByText(inToVal);
            calculateButton.Click();
            var currencyValue =outPutvalue.GetAttribute("value") ;

            Thread.Sleep(900);//Not a good practise to use Sleep
               //Get the screen shot of the web page and save it on local disk
               SaveScreenShot(WebDriver.Title);
            Assert.AreEqual(expectedValue,currencyValue.Replace("INR","").Trim());
        }