public static CssBy Component <T>(this CssBy cssBy) { return(cssBy.WithAttribute("data-component-name", typeof(T).Name)); }
public static ItemBy FixedByKey(this CssBy cssBy) { return(cssBy.FixedByAttribute("data-key")); }
public static CssBy Component(this CssBy cssBy, string name) { return(cssBy.WithAttribute("data-component-name", name)); }
public static CssBy WithTid(this CssBy cssBy, string tid) { return(cssBy.WithAttribute("data-tid", tid)); }
public static CssBy WithKey(this CssBy cssBy, string key) { return(cssBy.WithAttribute("data-key", key)); }
private ElementsCollection <T> CreateCollection <T>(ISearchContext globalContext, ISearchContext searchContext, CssBy cssBy) where T : ComponentBase { T Func(ISearchContext sc, By by, IWebElement we) => CreateComponent <T>(globalContext, sc, by); ItemBy ItemByLambda(ByDummy x) => cssBy.FixedByIndex(); return(Activator.CreateInstance(typeof(ElementsCollection <T>), searchContext, (ItemByLambda)ItemByLambda, (Func <ISearchContext, By, IWebElement, T>)Func) as ElementsCollection <T>); }
private object TryCreate(Type type, ISearchContext globalContext, ISearchContext searchContext, CssBy cssBy, object[] additionalArgs) { if (IsTypeElementsCollection(type)) { return(CreateCollection(type.GetGenericArguments().First(), globalContext, searchContext, cssBy)); } if (IsComponent(type)) { return(CreateComponent(type, globalContext, searchContext, cssBy, additionalArgs)); } return(null); }
public void TestThenDescendant() { var actual = new CssBy("aaa").ThenDescendant("xxx"); Assert.That(actual.Selector, Is.EqualTo("aaa xxx")); }
private object CreateCollection(Type componentType, ISearchContext globalContext, ISearchContext searchContext, CssBy cssBy) { return(createCollection.MakeGenericMethod(componentType).Invoke(this, new object[] { globalContext, searchContext, cssBy })); }
public void TestXPath() { var actual = new CssBy("aaa").Css("xxx").Css("yyy"); Assert.That(actual.Selector, Is.EqualTo("aaaxxxyyy")); }
public void TestWithIndex() { var actual = new CssBy().WithIndex(123); Assert.That(actual.Selector, Is.EqualTo(":nth-child(124)")); }
public void TestWithId() { var actual = new CssBy().WithId("xxx"); Assert.That(actual.Selector, Is.EqualTo("#xxx")); }
public void TestWithAttribute() { var actual = new CssBy().WithAttribute("xxx"); Assert.That(actual.Selector, Is.EqualTo("[xxx]")); }
public void TestThenChild() { var actual = new CssBy("aaa").ThenChild("xxx"); Assert.That(actual.Selector, Is.EqualTo("aaa>xxx")); }