/// <summary> /// Constructs a layout object from a XML data object. /// </summary> /// <param name="parentElement">The element which relates to this layout.</param> /// <param name="dataXmlLayoutDefinition">The data object which is the base for this layout object.</param> public LayoutContainer(IPageElement parentElement, Data.Xml.Layout.XmlLayoutDefinition dataXmlLayoutDefinition) { _element = parentElement; _virtualLayout.Width = new Unit(dataXmlLayoutDefinition.Width.Value); _virtualLayout.Width.AddRelation(GetRelation(dataXmlLayoutDefinition.Width)); _virtualLayout.Height = new Unit(dataXmlLayoutDefinition.Height.Value); _virtualLayout.Height.AddRelation(GetRelation(dataXmlLayoutDefinition.Height)); _virtualLayout.Left = new Unit(dataXmlLayoutDefinition.HOffset.Value); _virtualLayout.Left.AddRelation(GetRelation(dataXmlLayoutDefinition.HOffset)); _virtualLayout.Top = new Unit(dataXmlLayoutDefinition.VOffset.Value); _virtualLayout.Top.AddRelation(GetRelation(dataXmlLayoutDefinition.VOffset)); ResizeOptions resizeOptions = GetResizeOptions(dataXmlLayoutDefinition.Width); if (resizeOptions != null) { _virtualLayout.Width.AddResizeOptions(resizeOptions); } resizeOptions = GetResizeOptions(dataXmlLayoutDefinition.Height); if (resizeOptions != null) { _virtualLayout.Height.AddResizeOptions(resizeOptions); } SetLayout(); }
public static void SelectFrame(this IPageElement element, string additionalLocator = "") { if (element is Frame) { element.Page.Browser.SelectFrame(element.Locator); } }
private SeleniumElement GetSeleniumElement(IPageElement element) { if (!(element is SeleniumElement seleniumElement)) { throw new ArgumentException("Element is not compatible with a SeleniumFramework"); } return(seleniumElement); }
public BaseRelation(IPageElement element, string key, string from) { if (element.Parent.HasElement(key)) { _element = element.Parent[key]; _from = from; } }
/// <summary> /// Creates a layout for an element based on absolute values. /// </summary> /// <param name="width">string representing the width of the element.</param> /// <param name="height">string representing the height of the element.</param> /// <param name="xPosition">string representing the horizontal position of the element.</param> /// <param name="yPosition">string representing the vertical position of the element.</param> public LayoutContainer(IPageElement parentElement, string width, string height, string xPosition, string yPosition) { _element = parentElement; _virtualLayout.Width = new Unit(width); _virtualLayout.Height = new Unit(height); _virtualLayout.Left = new Unit(xPosition); _virtualLayout.Top = new Unit(yPosition); SetLayout(); }
public static string GetText(this IPageElement element, string additionalLocator = "") { if (element is TextBox) { return(element.Page.Browser.GetValue(element.Locator, additionalLocator)); } else { return(element.Page.Browser.GetText(element.Locator, additionalLocator)); } }
/// <summary> /// Creates a layout for an element based on absolute values. /// </summary> /// <param name="width">Unit representing the width of the element.</param> /// <param name="height">Unit representing the height of the element.</param> /// <param name="xPosition">Unit representing the horizontal position of the element.</param> /// <param name="yPosition">Unit representing the vertical position of the element.</param> public LayoutContainer(IPageElement parentElement, Unit width, Unit height, Unit xPosition, Unit yPosition) { _element = parentElement; _virtualLayout.Width = width; _virtualLayout.Height = height; _virtualLayout.Left = xPosition; _virtualLayout.Top = yPosition; SetLayout(); }
private static OpenXmlElement PartToOpenXmlElement(IPageElement part, WordprocessingDocument document) { var paragraph = part as Core.Paragraph; if (paragraph != null) { return(ParagraphConverter.Convert(paragraph, document)); } var table = part as Table; if (table != null) { return(TableConverter.Convert(table, document)); } throw new InvalidOperationException($"can't convert part of page with type [{part.GetType()}] to OpenXmlElement"); }
public MsHtmlPageElement(IPageDocument pageDocument, IHTMLElement htmlElement, IPageElement parentElement) { _htmlElement = htmlElement; PageDocument = pageDocument; Parent = parentElement; Attributes = new MsHtmlAttributes(htmlElement); Path = $"{(parentElement == null ? string.Empty : parentElement.Path)}/{Tag}"; _content = new Lazy<string>(GetContent); //create children list including references to previous and next element var list = new List<IPageElement>(); MsHtmlPageElement previousElement = null; foreach (IHTMLElement childElement in (IHTMLElementCollection) _htmlElement.children) { var currentElement = new MsHtmlPageElement(PageDocument, childElement, this); list.Add(currentElement); currentElement.PreviousSibling = previousElement; if (previousElement != null) { previousElement.NextSibling = currentElement; // calculate node index IPageElement element = previousElement; while (element != null) { if (element.Tag == Tag) { currentElement.NodeIndex = element.NodeIndex + 1; break; } element = element.PreviousSibling; } } previousElement = currentElement; } Children = list.ToArray(); }
public void HoverOver(IPageElement element) { var seleniumElement = GetSeleniumElement(element); new Actions(WebDriver).MoveToElement(seleniumElement.Element).Perform(); }
public void EnterText(IPageElement element, string text) { var seleniumElement = GetSeleniumElement(element); seleniumElement.Element.SendKeys(text); }
public Relation(IPageElement element, string key, string from) : base(element, key, from) { }
public void DoubleClick(IPageElement element) { var seleniumElement = GetSeleniumElement(element); new Actions(WebDriver).DoubleClick(seleniumElement.Element).Perform(); }
public static string GetValue(this IPageElement element, string additionalLocator = "") { return(element.Page.Browser.GetValue(element.Locator, additionalLocator)); }
public PdfRectangle(PdfContentByte content, PdfDocument pdfDocument, IPageElement rectangle) : base(content, pdfDocument, rectangle) { }
public DuplicateKeyException(IPageElement element) { SetMessage("Unable to add element with key " + element.Key + " in context " + element.Parent.Key + "."); }
/// <summary> /// Parses an OpenTemplater Text model to a PDF text model. /// </summary> /// <param name="pdfDocument"></param> /// <param name="bText"></param> /// <returns></returns> public PdfText(PdfContentByte content, PdfDocument pdfDocument, IPageElement bText) : base(content, pdfDocument, bText) { ObjectLayoutContainer = Element.LayoutContainer; ParseTextlines(); }
public static void EnterText(this IPageElement element, string value, string additionalLocator = "") { element.Page.Browser.EnterText(element.Locator, value, additionalLocator); }
private void AddAllPageElements(IPageElement pageElement) { PageElements.Add(pageElement.GetUniquePath(), pageElement); foreach (IPageElement child in pageElement.Children) AddAllPageElements(child); }
public static string GetSelectedItemText(this IPageElement element, string additionalLocator = "") { return(element.Page.Browser.GetSelectedItemText(element.Locator, additionalLocator)); }
public static bool IsSelected(this IPageElement element, string additionalLocator = "") { return(element.Page.Browser.IsSelected(element.Locator, additionalLocator)); }
public void Add(IPageElement item) { throw new NotImplementedException(); }
public void AddElement(IPageElement element) { _contents.Elements.Add(element); }
public static string GetElementErrorMessage(this IPageElement element) { return(element.Page.Browser.GetElementErrorMessage(element.Locator)); }
/// <summary> /// Adds a new page element to the page contents. /// </summary> /// <param name="item">An element which implements the IPageElement interface.</param> public void Add(IPageElement item) { this.Contents.Add(item); }
private void Add(IPageElement element) => Elements.Add(element);
protected BaseElement(PdfContentByte pdfContent, PdfDocument document, IPageElement element) { _pdfContent = pdfContent; _document = document; _element = element as T; }
public Until(IPageElement element, string key, string from) : base(element, key, from) { }
public PdfLine(PdfContentByte content, PdfDocument document, IPageElement line) : base(content, document, line) { }
public static bool Exists(this IPageElement element, string additionalLocator = "") { return(element.Page.Browser.Exists(element.Locator, additionalLocator)); }
public PdfImage(PdfContentByte content, PdfDocument document, IPageElement image) : base(content, document, image) { }
public static int GetCount(this IPageElement element, string addiitonalLocator = "") { return((int)element.Page.Browser.GetXPathCount(element.Locator, addiitonalLocator)); }