namespace CrmSeleniumUnitTest { [TestClass] public class OpportunityTests { [TestMethod] public void WeightedSummCalculate() { decimal estimatedValue = 1000m; decimal expectedWeightedValue = estimatedValue * 0.3m; string contentFrame = "contentIFrame"; string estimatedValueId = "estimatedvalue"; string weightedEstimatedValueId = "isv_weightedestimatedvalue"; string weightedEstimatedValueAttribute = "value"; var driver = new InternetExplorerDriver(); driver.Navigate().GoToUrl("https://test.crm.crm"); driver.SwitchTo().Frame(contentFrame); var estimatedValueElement = driver.FindElement(By.Id(estimatedValueId)); estimatedValueElement.Clear(); estimatedValueElement.SendKeys(Keys.Tab); estimatedValueElement.SendKeys(estimatedValue.ToString(CultureInfo.InvariantCulture)); estimatedValueElement.SendKeys(Keys.Tab); Thread.Sleep(10000); var weightedValueElement = driver.FindElement(By.Id(weightedEstimatedValueId)); var actualWeightedValue = Decimal.Parse(weightedValueElement.GetAttribute(weightedEstimatedValueAttribute),CultureInfo.InvariantCulture); driver.Quit(); Assert.AreEqual(expectedWeightedValue, actualWeightedValue); } } }
Source: https://habr.com/ru/post/274001/
All Articles