Ejemplo n.º 1
0
        /// <summary>
        /// This is done to facilitate CSS selector look up in IEElementCollection
        /// </summary>
        /// <param name="parentDocument"> </param>
        /// <param name="frameDocument"> </param>
        private void SetFrameHierarchy(Frame parentDocument, INativeDocument frameDocument)
        {
            var nameOrId  = GetFrameElementNameOrId(FrameElement);
            var hierarchy = string.Empty;

            if (parentDocument != null)
            {
                var frameElement = parentDocument.FrameElement;
                hierarchy = frameElement.GetAttributeValue("data-watinFrameHierarchy") + ".";
            }

            hierarchy = hierarchy + nameOrId;

            FrameElement.SetAttributeValue("data-watinFrameHierarchy", hierarchy);
            frameDocument.RunScript(frameDocument.JavaScriptVariableName + ".___WATINFRAMEHIERARCHY = '" + hierarchy + "'", "javascript");
        }
Ejemplo n.º 2
0
        private static string GetFrameElementNameOrId(Element frameElement)
        {
            var idOrName = frameElement.Name;

            if (string.IsNullOrEmpty(idOrName))
            {
                idOrName = frameElement.Id;
            }

            if (string.IsNullOrEmpty(idOrName))
            {
                idOrName = "frame_" + frameElement.GetJavascriptElementReference();
                frameElement.SetAttributeValue("Id", idOrName);
            }

            return(idOrName);
        }
Ejemplo n.º 3
0
 public virtual void SetAttributeValue(string attributeName, string value)
 {
     _frameElement.SetAttributeValue(attributeName, value);
 }