public HeatmapCellModel GetCellInformation(IWebElement cell) { HeatmapCellModel result = new HeatmapCellModel(); new WebDriverWait(webdriver, TimeSpan.FromSeconds(Constants.WAIT_TIME_DEFAULT)).Until(ExpectedConditions.ElementToBeClickable(cell)); IList <IWebElement> statusAreas = cell.FindElements(statusElements); foreach (IWebElement color in statusAreas) { var colorRawKey = color.GetAttribute("class"); var colorRawValue = color.GetAttribute("style"); var colorKey = colorRawKey.Replace("status-", ""); var colorValue = colorRawValue .Replace("width: 100%; height: ", "") .Replace("%;", "") .Replace("width: 0px; height: ", "") .Replace("px;", "") .Trim(); result.colors.Add(colorKey, colorValue); } result.CalculateVisibleColors(); return(result); }
/************************************************************************/ public void GrabCellsColorsData() { IList <HeatmapCellModel> results = new List <HeatmapCellModel>(); new WebDriverWait(webdriver, TimeSpan.FromSeconds(Constants.WAIT_TIME_DEFAULT)).Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div[ng-show='heatmap.showSummaries']"))); new WebDriverWait(webdriver, TimeSpan.FromSeconds(Constants.WAIT_TIME_DEFAULT)).Until(ExpectedConditions.ElementToBeClickable(cellListLocator)); IList <IWebElement> cellList = webdriver.FindElements(cellListLocator); foreach (IWebElement elementNow in cellList) { HeatmapCellModel itemData = GetCellInformation(elementNow); results.Add(itemData); } }
internal Boolean ClickOnColouredCell(int colorCount) { Boolean isFound = false; new WebDriverWait(webdriver, TimeSpan.FromSeconds(Constants.WAIT_TIME_DEFAULT)).Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div[ng-show='heatmap.showSummaries']"))); new WebDriverWait(webdriver, TimeSpan.FromSeconds(Constants.WAIT_TIME_DEFAULT)).Until(ExpectedConditions.ElementToBeClickable(cellListLocator)); IList <IWebElement> cellList = webdriver.FindElements(cellListLocator); foreach (IWebElement elementNow in cellList) { HeatmapCellModel itemData = GetCellInformation(elementNow); if (itemData.CalculateVisibleColors() == colorCount) { elementNow.Click(); isFound = true; break; } } return(isFound); }