public List <FilesGridRecord> GetRecords() { var entities = new List <FilesGridRecord>(); Driver.WaitForElements(GridRowLocator); var parser = new HtmlParser(); var doc = parser.Parse(Driver.PageSource); var rows = doc.QuerySelectorAll(GridRowCssLocatorText); try { foreach (var row in rows) { var files = new FilesGridRecord(); var cells = row.QuerySelectorAll(GridCellCssSelector); var cellsTexts = cells.Select(t => t.TextContent).ToList(); files.Name = cellsTexts[0]; files.Editor = cellsTexts[1]; files.CreationDate = cellsTexts[2]; if (Parameters.Parameters.Browser == "MicrosoftEdge") { files.CreationDate = ServiceMethods.ConvertEdgeDateToUtf(files.CreationDate); } entities.Add(files); } } catch (ArgumentOutOfRangeException) { return(entities); } return(entities); }
public List <WorkpieceGridRecord> GetRecords(int timeoutSec) { List <WorkpieceGridRecord> entities = new List <WorkpieceGridRecord>(); this.Driver.WaitForElements(this.GridRowLocator); string error; int i = 0; do { try { var parser = new HtmlParser(); error = string.Empty; var doc = parser.Parse(this.Driver.PageSource); var gridRowCssSelector = GridRowCssLocatorText; var gridCellCssSelector = "td"; var rows = doc.QuerySelectorAll(gridRowCssSelector); foreach (var row in rows) { var workpiece = new WorkpieceGridRecord(); var cells = row.QuerySelectorAll(gridCellCssSelector); var cellsTexts = cells.Select(t => t.TextContent).ToList(); workpiece.Id = cellsTexts[0]; workpiece.Name = cellsTexts[1]; workpiece.Quantity = cellsTexts[2]; workpiece.DeliveryDate = cellsTexts[3]; if (Parameters.Parameters.Browser == "MicrosoftEdge") { workpiece.DeliveryDate = ServiceMethods.ConvertEdgeDateToUtf(workpiece.DeliveryDate); } entities.Add(workpiece); } } catch (Exception e) { error = e.Message; Thread.Sleep(1000); entities.Clear(); } }while (error != string.Empty && i++ < timeoutSec); if (i >= timeoutSec) { throw new Exception(error); } return(entities); }
public string GetOrderDetailsContent(string fieldName) { By locator = By.XPath(string.Format(this.orderDataFieldMask, fieldName)); var text = this.Driver.Find(locator).Text; var content = text.Trim(); if (Parameters.Parameters.Browser == "MicrosoftEdge") { content = ServiceMethods.ConvertEdgeDateToUtf(content); } return(content); }
public List <OrderGridRecord> GetRecords() { var parser = new HtmlParser(); List <OrderGridRecord> entities = new List <OrderGridRecord>(); var doc = parser.Parse(this.Driver.PageSource); var gridRowCssSelector = GridRowCssLocatorText; var gridCellCssSelector = "td"; var rows = doc.QuerySelectorAll(gridRowCssSelector); foreach (var row in rows) { var order = new OrderGridRecord(); var cells = row.QuerySelectorAll(gridCellCssSelector); var cellsTexts = cells.Select(t => t.TextContent).ToList(); order.OrderId = cellsTexts[0]; order.Customer = cellsTexts[1]; order.DeliveryDate = cellsTexts[2].Replace("?", string.Empty); if (Parameters.Parameters.Browser == "MicrosoftEdge") { order.DeliveryDate = ServiceMethods.ConvertEdgeDateToUtf(order.DeliveryDate); } order.Editor = cellsTexts[3]; order.CreationDate = cellsTexts[4].Replace("?", string.Empty); if (Parameters.Parameters.Browser == "MicrosoftEdge") { order.CreationDate = ServiceMethods.ConvertEdgeDateToUtf(order.CreationDate); } entities.Add(order); } return(entities); }