public ElementCollection CreateHierarchy() { ElementCollection result = new ElementCollection(); for (int index = 0; index < elements.Count; index++) { Element element = elements[index]; if (element is Entity.Text) result.Add(element); else if (element is Expression) result.Add(element); else if (element is Tag) { result.Add(CollectForTag((Tag) element, ref index)); } else if (element is TagClose) { throw new ParseException("Close tag for " + ((TagClose) element).Name + " doesn't have matching start tag.", element.Line, element.Col); } else throw new ParseException("Invalid element: " + element.GetType().ToString(), element.Line, element.Col); } return result; }
public void testCount() { driver.Navigate().GoToUrl("http://www.google.com"); var elements = new ElementCollection(driver.FindElements(By.Name("q"))); driver.Navigate().GoToUrl("http://www.google.com"); Assert.Count(1, elements.Where(x => x.IsStale())); }
public Tag(int line, int col, string name) : base(line, col) { this.name = name; this.attribs = new TagAttributeCollection(); this.innerElements = new ElementCollection(); }
/// <summary> /// Reads in Mesh information from a stream. Does not look back in the stream /// </summary> /// <param name="StreamWithMeshInfo"></param> private void ReadMesh() { elements = new ElementCollection(); connections = new List<Connection>(); using (StreamReader StreamWithMeshInfo = new StreamReader(FileName)) { while (!StreamWithMeshInfo.EndOfStream) { string word = StreamWithMeshInfo.ReadLine().Trim().ToUpper(); if (word.StartsWith("ELEME")) { word = StreamWithMeshInfo.ReadLine().Trim(); while (word != string.Empty) { Elements.Add(new Element(word)); word = StreamWithMeshInfo.ReadLine().Trim(); } } else if (word.StartsWith("CONNE")) { word = StreamWithMeshInfo.ReadLine().Trim(); while (word != string.Empty & word != "+++") { Connection C = new Connection(word, Elements); Connections.Add(C); word = StreamWithMeshInfo.ReadLine().Trim(); } } } } }
public void TestBy() { var elements = new ElementCollection(By.Name("q")); driver.Navigate().GoToUrl("http://www.google.com"); elements.ForEach(x => x.Click()); driver.Navigate().GoToUrl("http://www.google.com"); elements.ForEach(x => x.SendKeys("test")); }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element">The browser element this is for.</param> /// <param name="browser">The browser this element is associated with.</param> /// <param name="collection">The collection this element is associated with.</param> public Element(JToken element, Browser browser, ElementCollection collection) { _element = element; _browser = browser; _collection = collection; _orginalColor = GetStyleAttributeValue("backgroundColor") ?? ""; _highlightColor = "yellow"; }
public TemplateEntity(string name, ElementCollection elements, TemplateEntity parent) { this.name = name; this.elements = elements; this.parent = parent; InitTemplates(); }
/// <summary> /// Initializes a new instance of the Browser class. /// </summary> protected Browser(Application application) { Application = application; AutoClose = false; AutoRefresh = true; Elements = new ElementCollection(); JavascriptLibraries = new JavaScriptLibrary[0]; Timeout = TimeSpan.FromSeconds(10); }
/// <summary> /// 获取多项 /// </summary> /// <returns></returns> protected List <string> GetMutiContent() { ElementCollection elements = GetWindow().Elements.Filter(GetConstraint()); List <string> list = new List <string>(); foreach (var el in elements) { string val = GetValue(el); if (!(string.IsNullOrEmpty(val) && FliterEmptyString)) { list.Add(val); } } return(list); }
private List <IHTMLElement> ToHTMLElement(ElementCollection elements) { if (elements == null) { return(null); } List <IHTMLElement> list = new List <IHTMLElement>(); foreach (var element in elements) { var nativeElement = element.NativeElement as IEElement; list.Add((IHTMLElement)nativeElement.AsHtmlElement); } return(list); }
private static void RemoveEmptyGroups(ElementCollection elements) { for (var i = 0; i < elements.Count; i++) { if (!(elements[i] is ElementWithChildren element)) { continue; } RemoveEmptyGroups(element.Children); if (element.Children.All(x => x is ClipPath)) { elements.RemoveAt(i--); } } }
/// <summary> /// Compares the position value of elements in list and calculates number of lines in the element definition. /// </summary> /// <param name="collection"></param> /// <param name="source"></param> public static void IndexElementDefinitions(ElementCollection collection, string[] source) { for (int idx = 0; idx < collection.Elements.Count; idx++) { //Handle last element if (collection.Elements.Count == idx + 1) { int lastIndex = source.Length - 1; collection.Elements[idx].DefinitionLengthInLines = lastIndex - collection.Elements[idx].Position; continue; } //Handle all other elements int differenceInPosition = collection.Elements[idx + 1].Position - collection.Elements[idx].Position - 1; collection.Elements[idx].DefinitionLengthInLines = differenceInPosition; } }
private static void ResetIneffectiveAttributesRecursively(ElementCollection elements) { foreach (var element in elements) { switch (element) { case ElementWithChildren elementWithChild: ResetIneffectiveAttributesRecursively(elementWithChild.Children); break; case Path leafElement: ResetIneffectiveAttributes(leafElement); break; } } }
/// <summary> /// Get all linear elements in the specified model which have a mapping entry in this table /// </summary> /// <param name="inModel"></param> /// <returns></returns> public ElementCollection AllMappedPanelElements(Model.Model inModel) { var result = new ElementCollection(); if (ContainsKey(PanelCategory)) { foreach (Guid guid in this[PanelCategory].Keys) { if (inModel.Elements.Contains(guid)) { result.Add(inModel.Elements[guid]); } } } return(result); }
public List <IHTMLElement> GetIHTMLElements() { List <IHTMLElement> iels = new List <IHTMLElement>(); ElementCollection els = GetElements(); foreach (var element in els) { if (element == null) { continue; } var el = element.NativeElement as IEElement; iels.Add(el.AsHtmlElement); } return(iels); }
/// <summary> /// 通过xpath查找页面元素,包括多个元素的情况 /// </summary> /// <param name="xpath"></param> /// <param name="action"></param> public void findManyByXPath(string xpath, Jint.Delegates.Action <int, ElementWrapper> action) { ElementCollection elements = Browser.GetElementsByXPath(xpath); int index = 0; foreach (Element el in elements) { try { action(index++, new ElementWrapper(Browser, el)); } catch (Exception ex) { logger.Fatal(ex); } } }
public Connection(string FromString, ElementCollection ElemeCollection) { First = ElemeCollection[FromString.Substring(0, 5)]; Second = ElemeCollection[FromString.Substring(5, 5)]; PermeabilityDirection = int.Parse(FromString.Substring(29, 1)); Distance1 = double.Parse(FromString.Substring(30, 10)); Distance2 = double.Parse(FromString.Substring(40, 10)); Area = double.Parse(FromString.Substring(50, 10)); if (FromString.Length > 60) { string temp = FromString.Substring(60, FromString.Length -60).Trim(); if (temp != string.Empty) CosineAngle = double.Parse(temp); } }
public void GetElementsShouldReturnSubSections() { Section root = new Section(); Section child1 = new Section(); Section child2 = new Section(); root.AddSection("Dummy", child1); root.AddSection("Dummy", child2); ElementCollection children = root.GetElements("Dummy"); Assert.NotNull(children); Assert.Equal(2, children.Count); Assert.Equal(child1, (children[0] as SectionElement).Value); Assert.Equal(child2, (children[1] as SectionElement).Value); }
private void CleanupElements(bool removeFromCollection) { var rowBindings = RowBindings; Debug.Assert(Elements.Count == rowBindings.Count); for (int i = 0; i < rowBindings.Count; i++) { var rowBinding = rowBindings[i]; var element = Elements[i]; rowBinding.Cleanup(element); } if (removeFromCollection) { ElementCollection.RemoveRange(0, Elements.Count); } }
private CurrentContainerViewPlacement DoRealize(int ordinal) { Debug.Assert(CurrentContainerView != null); if (CurrentContainerView.ContainerOrdinal == ordinal) { return(CurrentContainerViewPlacement.WithinList); } var index = HeadScalarElementsCount; switch (CurrentContainerViewPlacement) { case CurrentContainerViewPlacement.Alone: if (ordinal > CurrentContainerView.ContainerOrdinal) { index++; } break; case CurrentContainerViewPlacement.BeforeList: index++; if (ordinal > ContainerViewList.Last.ContainerOrdinal) { index += ContainerViewList.Count; } break; case CurrentContainerViewPlacement.WithinList: case CurrentContainerViewPlacement.AfterList: if (ordinal > ContainerViewList.Last.ContainerOrdinal) { index += ContainerViewList.Count; } break; } var containerView = Setup(ordinal); ElementCollection.Insert(index, containerView); if (CurrentContainerViewPlacement == CurrentContainerViewPlacement.Alone) { return(ordinal > CurrentContainerView.ContainerOrdinal ? CurrentContainerViewPlacement.BeforeList : CurrentContainerViewPlacement.AfterList); } return(CurrentContainerViewPlacement); }
internal override Element Parse(XElement element) { base.ParseXml(element); if (element.HasElements) { List <Element> nodes = new List <Element>(); element.Elements().ToList().ForEach(entry => { string nodeName = entry.Name.LocalName; if (ElementCollection.Contains(nodeName)) { nodes.Add(ElementCollection .Resolve(nodeName) .Parse(entry)); } }); nodes .Where(group => (group is Group)) .ToList() .ForEach(g => { this.Groups.Add(g as Group); }); nodes .Where(transition => (transition is Transition)) .ToList() .ForEach(g => { this.Transitions.Add(g as Transition); }); nodes .Where(actor => (actor is Actor)) .ToList() .ForEach(actor => { this.actors.Add(actor as Actor); }); } return(this); }
public override bool Execute(ExecutionInfo exInfo = null) { Elements = new ElementCollection(); if (Geometry != null) { // Convert each geometry item: foreach (VertexGeometry shape in Geometry) { if (shape is Curve) // Convert to linear element { LinearElement element = Model.Create.LinearElement((Curve)shape, exInfo); if (FamiliesFromLayers && shape.Attributes != null && !string.IsNullOrWhiteSpace(shape.Attributes.LayerName)) { string layerName = shape.Attributes.LayerName; SectionFamily sF = Model.Families.Sections.FindByName(layerName); if (sF == null) { sF = Model.Create.SectionFamily(layerName, exInfo); } element.Family = sF; } Elements.Add(element); } else if (shape is Surface) //Reminder: Meshes are also surfaces! { PanelElement element = Model.Create.PanelElement((Surface)shape, exInfo); if (FamiliesFromLayers && shape.Attributes != null && !string.IsNullOrWhiteSpace(shape.Attributes.LayerName)) { string layerName = shape.Attributes.LayerName; BuildUpFamily fF = Model.Families.PanelFamilies.FindByName(layerName); if (fF == null) { fF = Model.Create.BuildUpFamily(layerName, exInfo); } element.Family = fF; } Elements.Add(element); } } Elements.GenerateNodes(new NodeGenerationParameters()); return(true); } return(false); }
/// <summary> /// Override function which invalidates the representations of objects as necessary when a design update occurs /// In this case, the offset display needs to be updated whenever node geometry changes as well as /// the element geometry (which is done by default) /// </summary> /// <param name="doc"></param> /// <param name="e"></param> public override void InvalidateOnUpdate(object modified, PropertyChangedEventArgs e) { if (modified is Node) { Node sp = (Node)modified; ElementCollection els = sp.GetConnectedElements(); foreach (Element lEl in els) { InvalidateRepresentation(lEl); } Core.Instance.Host.Refresh(); } else { base.InvalidateOnUpdate(modified, e); //if (modified is LinearElement && (e.PropertyName == "Family" || e.PropertyName == "Orientation")) Core.Instance.Host.Refresh(); } }
public override void Perform() { ElementCollection elements = GetWindow().Elements.Filter(GetConstraint()); List <string> list = new List <string>(); foreach (var el in elements) { string val = GetValue(el); if (!string.IsNullOrEmpty(val)) { list.Add(val); } } if (list.Count > 0) { VariableModel.Find <ActionArrayVariable>(ObjectName).AddItemsToList(list); } }
private void UpdateCurrentContainerView(RowView rowView) { if (CurrentContainerViewPlacement != CurrentContainerViewPlacement.WithinList) { Cleanup(CurrentContainerView); if (CurrentContainerViewPlacement == CurrentContainerViewPlacement.BeforeList) { ElementCollection.RemoveAt(HeadScalarElementsCount); } else { Debug.Assert(CurrentContainerViewPlacement == CurrentContainerViewPlacement.AfterList); ElementCollection.RemoveAt(HeadScalarElementsCount + ContainerViewList.Count); } CurrentContainerViewPlacement = CurrentContainerViewPlacement.WithinList; } CurrentContainerView = GetContainerView(rowView); }
public static void BeautifyAll(string identifier, Element parent, MatchOptions2 Options2) { ElementCollection List = (parent == null) ? Document.GetElementsByTagName("*") : parent.GetElementsByTagName("*"); if (List == null) { return; } Element[] L = new Element[List.Length]; for (int i = 0; i < List.Length; i++) { L[i] = List[i]; } if (Options2 == null) { Options2 = MapRules.DefaultOptions(); Options2.ShowGV = true; } for (int i = 0; i < L.Length; i++) { Element elem = L[i]; string chandam = (string)elem.GetAttribute("chandam"); string identifier2 = (string)elem.GetAttribute("chandassu"); if (chandam == "0") { continue; } if (chandam == "1" || identifier2 != "") { if (identifier2 != null && identifier2 != "") { Beautify(elem, identifier2, Options2); } else { Beautify(elem, identifier, Options2); } } } }
internal override IEnumerable <Element> GetElements() { // **************************************************************** List <ExportFunction> functions = new List <ExportFunction>(m_functions.Values); functions.Sort(); ElementCollection content = new ElementCollection(); ElementCollection header = content.ElementCollection(); ElementCollection functionAddresses = content.ElementCollection(); ElementCollection functionNames = content.ElementCollection(); ElementCollection functionOrdinals = content.ElementCollection(); ElementCollection names = content.ElementCollection(); header.UInt32(0); // Export flags header.UInt32(0); // date header.UInt16(0); // major version header.UInt16(0); // minor version header.RelativeMemoryAddress32(m_moduleNameElement); // module name header.UInt32(1); // ordinal base header.UInt32((UInt32)functions.Count); // address table entries header.UInt32((UInt32)functions.Count); // number of name pointers header.RelativeMemoryAddress32(functionAddresses); // function addresses header.RelativeMemoryAddress32(functionNames); // function names header.RelativeMemoryAddress32(functionOrdinals); // function ordinals // Module name names.Elements.Add(m_moduleNameElement); for (int i = 0; i < functions.Count; i++) { ExportFunction function = functions[i]; functionAddresses.RelativeMemoryAddress32(function.Function); functionNames.RelativeMemoryAddress32(function.NameElement); functionOrdinals.UInt16((UInt16)i); names.Elements.Add(function.NameElement); } return(content.Elements); }
protected override void OnClick() { IMap map = ArcMap.Document.ActiveView as IMap; IGeoFeatureLayer geoFeatureLayer = map.get_Layer(0) as IGeoFeatureLayer; IAnnotateLayerPropertiesCollection annotateLayerPropertiesCollection = geoFeatureLayer.AnnotationProperties; LabelEngineLayerProperties labelEngineLayerProperties = new LabelEngineLayerProperties(); IAnnotateLayerProperties annotateLayerProperties = labelEngineLayerProperties as IAnnotateLayerProperties; IElementCollection placedElements = new ElementCollection(); IElementCollection unplacedElements = new ElementCollection(); annotateLayerPropertiesCollection.QueryItem(1, out annotateLayerProperties, out placedElements, out unplacedElements); // 0 = default, 1 = 1st Class string className = annotateLayerProperties.Class; System.Diagnostics.Debug.WriteLine("Class Name: " + className); ArcMap.Application.CurrentTool = null; }
private List <string> GetHrefList() { ElementCollection elements = GetWindow().Elements.Filter(GetConstraint()); List <string> list = new List <string>(); foreach (var el in elements) { Link anchor = el as Link; if (anchor == null) { anchor = el.Parent as Link; } if (anchor != null) { list.Add(anchor.Url); } } return(list); }
public void AddZ_Multiple_Keeps_All_Elements() { var time0 = new ElementCollection(); time0.xtor(); var element0 = new Element { ScheduleStyle = ElementScheduleStyle.Multiple }; //(MockElement.Multiple); time0.Add(element0, 0); // var time1 = new ElementCollection(); time1.xtor(); var element1 = new Element { ScheduleStyle = ElementScheduleStyle.Multiple }; //(MockElement.Multiple); time1.Add(element1, 0); Assert.AreEqual(time0.GetCount(), 1); Assert.AreEqual(time1.GetCount(), 1); }
internal virtual void VirtualizeAll() { Debug.Assert(ContainerViewList.Count > 0); var startIndex = ContainerViewListStartIndex; for (int i = ContainerViewList.Count - 1; i >= 0; i--) { var containerView = ContainerViewList[i]; if (containerView == CurrentContainerView) { continue; } Cleanup(containerView); ElementCollection.RemoveAt(startIndex + i); } CurrentContainerViewPlacement = CurrentContainerViewPlacement.Alone; }
public void AddZ_LastWins_Moves_To_Last_Element() { var time0 = new ElementCollection(); time0.xtor(); var element0 = new Element { ScheduleStyle = ElementScheduleStyle.LastWins }; //(MockElement.LastWins); time0.Add(element0, 0); // var time1 = new ElementCollection(); time1.xtor(); var element1 = new Element { ScheduleStyle = ElementScheduleStyle.LastWins }; //(MockElement.LastWins); time1.Add(element1, 0); Assert.AreEqual(time0.GetCount(), 0); Assert.AreEqual(time1.GetCount(), 1); }
public static void ExtractElementDefinition(ElementCollection collection, string[] source) { foreach (ElementSymbol e in collection.Elements) { //Handle all elements int curPosition = e.Position; int defLength = e.DefinitionLengthInLines; StringCollection collectedLines = new StringCollection(); //Iterate over the lines, very important to make sure that the defLength is defined correctly for (int i = 0; i <= defLength; i++) { collectedLines.Add(source[curPosition]); curPosition++; } //Push the extracted lines to the element e.SourceData = collectedLines; } }
public void IntervalReadingChanged(object newValue) { if (MyModel.Axes.Count != 2 && VisiblePanel == false) { return; } ulong new_interval = Convert.ToUInt64(newValue); ulong current_min = Convert.ToUInt64(MyModel.Axes[1].Minimum); ulong current_max = Convert.ToUInt64(MyModel.Axes[1].Maximum); ulong plot_delta = Convert.ToUInt64(new_interval * 0.15); ulong last_series_val = 0; ElementCollection <Series> collection_series = MyModel.Series; if (collection_series.Count != 0) { LineSeries series = collection_series[0] as LineSeries; if (series.Points.Count != 0) { last_series_val = Convert.ToUInt64(series.Points.Last().X); } } if (last_series_val == 0 || last_series_val < new_interval) { current_min = last_series_val; current_max = new_interval; } else { current_min = last_series_val - new_interval; current_max = last_series_val + plot_delta; } ulong major_step = new_interval / 3; ulong minor_step = major_step / 4; MyModel.Axes[1].MajorStep = Convert.ToDouble(major_step); MyModel.Axes[1].MinorStep = Convert.ToDouble(minor_step); MyModel.Axes[1].Minimum = current_min; MyModel.Axes[1].Maximum = current_max; MyModel.InvalidatePlot(true); }
public void RaisesCollectionChangedEvent() { var collection = new ElementCollection<Axis>(new PlotModel()); ElementCollectionChangedEventArgs<Axis> eventArgs = null; var raisedCount = 0; collection.CollectionChanged += (sender, e) => { eventArgs = e; raisedCount++; }; var axis = new LinearAxis(); collection.Add(axis); Assert.AreEqual(1, raisedCount); Assert.AreEqual(1, eventArgs.AddedItems.Count); Assert.IsTrue(ReferenceEquals(axis, eventArgs.AddedItems[0])); }
/// <summary> /// Returns the direct descendent children elements. /// </summary> /// <remarks> /// Doe snot returns any text nodes between the elements. /// </remarks> /// <returns></returns> public ElementCollection GetChildNodes() { Interop.IHTMLDOMChildrenCollection children = (Interop.IHTMLDOMChildrenCollection)node.childNodes; ElementCollection ec = new ElementCollection(); int length = children.length; for (int i = 0; i < length; i++) { Interop.IHTMLDOMNode element = children.item(i) as Interop.IHTMLDOMNode; if (element != null && element != node) { if (element.nodeName.Equals("#text")) { continue; } ec.Add(this.htmlEditor.GenericElementFactory.CreateElement(element as Interop.IHTMLElement)); } } return(ec); }
//SETUP void SetupGame() { //CREATE GROUPS EntityCollection.Flush(); EntityCollection.CreateGroup("slot", "slots"); EntityCollection.CreateGroup("item", "items"); EntityCollection.CreateGroup("pickup", "pickups"); EntityCollection.CreateGroup("enemy", "enemies"); EntityCollection.CreateGroup("player", "players"); SetupUISystems(); ts = new NotTechnicallyATileset(vdims, ebuilder, Content); player = Assembler.GetEnt(ElementCollection.GetEntRef("player"), new Vector2(64, 65), Content, ebuilder); inven = new Inventory(Content); for (int x = 0; x < 3; x++) { inven.AddItem(Assembler.GetEnt(ElementCollection.GetEntRef("heart"), new Vector2(0, 0), Content, ebuilder)); } }
public static Element FindByClass(Element elem, string className) { ElementCollection coll = elem.Children; for (int i = 0; i < coll.Length; i++) { Element e2 = coll[i]; if (e2.ClassName == className) { return(e2); } Element e3 = FindByClass(e2, className); if (e3 != null) { return(e3); } } return(null); }
/// <summary> /// Method to retrieve visible Menus from Browser /// </summary> /// <param name="browser"></param> /// <returns></returns> public List <String> GetMenus(Browser browser) { List <String> result = new List <String>(); ElementCollection ec = browser.Elements.Filter(Find.ByClass("dxmMenuItem")); foreach (Element menu in ec) { result.Add(menu.Text); } ElementCollection ec1 = browser.Elements.Filter(Find.ByClass("dxmMenuItem dxmMenuItemSelected")); foreach (Element menu in ec1) { result.Add(menu.Text); } return(result); }
} //check whatever is plugged in to create input settings protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); ElementCollection.ReadDocument(XDocument.Load("Content/Xml/Registry.xml")); SpriteSheetCollection.LoadFromElementCollection(Content); cursorTex = SpriteSheetCollection.GetTex("static", "PlaceholderSheet", "cursor"); icons = SpriteSheetCollection.GetTex("idle", "buttons", "question"); meterTex = new TextureDrawer(Content.Load <Texture2D>("Placeholder/meter")); cloudTex = new TextureDrawer(Content.Load <Texture2D>("Sprites/clouds")); dd = TextureDrawer.FromHorizontalStrip(Content.Load <Texture2D>("Placeholder/Daytime"), 39); mm = TextureDrawer.FromHorizontalStrip(Content.Load <Texture2D>("Placeholder/MM"), 39); LoadBGs(); CreateUI(); SoundManager.AddSong(Content.Load <Song>("Audio/PrototypeMusic3"), "game"); //SoundManager.AddSong(Content.Load<Song>("Audio/tinymusic"), "game"); SoundManager.AddSong(Content.Load <Song>("Audio/MenuTrack"), "main"); SoundManager.AddEffect(Content.Load <SoundEffect>("Audio/build"), "build"); SoundManager.AddEffect(Content.Load <SoundEffect>("Audio/church_victory"), "win"); SoundManager.AddEffect(Content.Load <SoundEffect>("Audio/loss"), "lose"); SoundManager.AddEffect(Content.Load <SoundEffect>("Audio/sacrifice"), "sacrifice"); SoundManager.AddEffect(Content.Load <SoundEffect>("Audio/delevel"), "destroy"); gameBg = SpriteSheetCollection.GetTex("bg", "gameBgs", "bg"); clouds = SpriteSheetCollection.GetTex("clouds", "gameBgs", "bg"); mountains = SpriteSheetCollection.GetTex("fg", "gameBgs", "bg"); aendingAnim = SpriteSheetCollection.GetTex("bg", "endingSheet", "bg"); gded = SpriteSheetCollection.GetTex("bg", "churchEndingSheet", "bg"); SoundManager.PlaySong("main"); ParticleSystem.AcquireTxture(SpriteSheetCollection.GetTex("smoke", "smoke", "smoke")); CreateNewGame(); }
private static void EliminateUselessGroupNesting(ElementCollection elements) { for (var i = 0; i < elements.Count; i++) { var group = elements[i] as Group; if (group == null) { continue; } EliminateUselessGroupNesting(group.Children); if (IsUselessGroup(group)) { elements.RemoveAt(i); var count = group.Children.Count; while (group.Children.Count > 0) { elements.MoveTo(i, group.Children[group.Children.Count - 1]); } i += count - 1; } } }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public BiDirectionalIsolation(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public Meter(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public Summary(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public Abbreviation(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public OptionGroup(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public StrikeThrough(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public Legend(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public NoFrames(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public WordBreakOpportunity(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// 根据标签名获取所有同标签名的子元素标签 /// </summary> /// <param name="tagName"></param> /// <returns></returns> public virtual ElementCollection<Tag> GetChildTagsByTagName(string tagName) { if (string.IsNullOrEmpty(tagName)) throw new ArgumentNullException("tagName"); ElementCollection<Tag> tags = new ElementCollection<Tag>(); //搜索当前元素下的子元素 foreach (Element item in this.InnerElements) { if (item is Tag) { Tag tag = (Tag)item; if (tagName.Equals(tag.TagName, StringComparison.InvariantCultureIgnoreCase)) tags.Add(tag); //处理其下子元素 tags.AddRange(tag.GetChildTagsByTagName(tagName)); } } return tags; }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public Keyboard(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public KeyGenerator(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
public void TestElementAPI() { driver.Navigate().GoToUrl("http://www.google.com"); var elements = new ElementCollection(driver.FindElements(By.Name("q"))); elements.First().Click(); }
/// <summary> /// Initializes an instance of a line break browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public LineBreak(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public DescriptionListTerm(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
public void TestLinq() { driver.Navigate().GoToUrl("http://www.google.com"); var elements = new ElementCollection(driver.FindElements(By.XPath("//*"))); elements.First(x => x.GetAttribute("name") == "q" && x.Displayed).Click(); }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public Output(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }
/// <summary> /// Initializes an instance of a browser element. /// </summary> /// <param name="element"> The browser element this is for. </param> /// <param name="browser"> The browser this element is associated with. </param> /// <param name="collection"> The collection this element is associated with. </param> public HorizontalRule(JToken element, Browser browser, ElementCollection collection) : base(element, browser, collection) { }