public virtual TTControl PrecedingSibling <TTControl>() where TTControl : ControlBase, new() { TTControl tt = new TTControl(); tt.WrappedElement = FindWebElementFromCurrentWebElement("/preceding-sibling" + ClassAttribute.Get(typeof(TTControl)).Replace("/", "::") + "[1]"); return(tt); }
public virtual TTControl Parent <TTControl>() where TTControl : ControlBase, new() { TTControl tt = new TTControl(); tt.WrappedElement = FindWebElementFromCurrentWebElement(ClassAttribute.Get(typeof(TTControl)).Replace("/", "/parent::")); return(tt); }
public virtual TTControl FollowingSibling <TTControl>() where TTControl : ControlBase, new() { //e.g: "preceding-sibling::input[@type='radio'][1]" TTControl tt = new TTControl(); tt.WrappedElement = FindWebElementFromCurrentWebElement("/following-sibling" + ClassAttribute.Get(typeof(TTControl)).Replace("/", "::") + "[1]"); return(tt); }
public override IList <TTControl> GetControlCollection <TTControl>() { IList <TTControl> controlCollection = new List <TTControl>(); int i = 1; do { try { var tt = new TTControl(); tt.WrappedElement = FindWebElementFromCurrentWebElement(this._trBase + "[" + i.ToString() + "]"); if (tt.WrappedElement == null) { break; } controlCollection.Add(tt); i++; } catch (NotFoundException nx) { break; } } while (true); return(controlCollection); }
/// <summary> /// For getting the elements if the xpath can get 2 more elements /// </summary> //public IList<IWebElement> Collection //{ // get // { // return FindWebElementFromCurrentWebElement(ClassAttribute.Get(typeof(TTControl)).Replace("/", "/parent::")); // } //} public virtual IList <TTControl> GetControlCollection <TTControl>() where TTControl : ControlBase, new() { IList <TTControl> controlCollection = new List <TTControl>(); try { foreach (var item in FindWebElementFromCurrentWebElements(ClassAttribute.Get(typeof(TTControl)).Replace("/", "/parent::"))) { TTControl tt = new TTControl(); tt.WrappedElement = item; controlCollection.Add(tt); } } catch (NullReferenceException ex) { throw ex; } catch (NotFoundException) { Assert.Fail("No Control Found"); } return(controlCollection); }