Beispiel #1
0
        public void JQueryByFromElementCanRetrievePrimitiveTypeData()
        {
            var        element  = Driver.FindElement((By)By.jQuery(".depth-level-3-0-0-0"));
            JavaScript selector = element.ToJQueryBy().Parents(".depth-level").Children("span").Length;

            selector.ExecuteAndGet <long>(Driver).ShouldEqual(3);
        }
Beispiel #2
0
        public void WebElementToJQuerySelector()
        {
            var element = Driver.FindElement(By.CssSelector(".depth-level-2 > span"));

            By selector = element.ToJQueryBy().Parent().Find(".depth-level-3 > span");

            Driver.FindElement(selector).Text.ShouldEqual("---Div at depth 3 index 0");
        }
Beispiel #3
0
        public void CanRetrieveElementsComplex()
        {
            By  selector       = By.jQuery(".depth-level-3-0-0-0").Parents(".depth-level").Children("span");
            var textForParents = Driver.FindElements(selector).Select(x => x.Text).ToList();

            textForParents.ShouldHaveTheSameElementsAs(
                "--Div at depth 2 index 0",
                "-Div at depth 1 index 0",
                "Div at depth 0 index 0");
        }
Beispiel #4
0
        public void JQueryFindByText()
        {
            By selector = By.jQuery(".depth-level-2 > span")
                          .Filter(JQuery.HasTextFilterFunction("--Div at depth 2 index 1"))
                          .Parent()
                          .Find(".depth-level-3 > span")
                          .Filter(JQuery.HasTextFilterFunction("---Div at depth 3 index 1"));

            var textFromFoundElements = Driver.FindElements(selector).Select(x => x.Text).ToList();

            textFromFoundElements.ShouldHaveTheSameElementsAs(
                "---Div at depth 3 index 1",
                "---Div at depth 3 index 1",
                "---Div at depth 3 index 1");
        }
        protected override void beforeEach()
        {
            var javascriptExecutor = MockFor <IJavaScriptExecutor>();

            javascriptExecutor.Stub(x => x.ExecuteScript(Arg <string> .Is.Anything, Arg <object[]> .Is.Anything)).Return(ExpectedResult);

            _searchContext = MockFor <ISearchContext>();

            var converter = MockFor <ISearchContextToJavaScriptExecutor>();

            converter.Stub(x => x.Convert(_searchContext)).Return(javascriptExecutor);
            JavaScriptBy.SearchContextConverter = converter;

            Selector = By.jQuery(".test");

            if (ExecuteFind)
            {
                Execute();
            }
        }
Beispiel #6
0
        public void CanRetrievePrimitiveTypeData()
        {
            JavaScript selector = By.jQuery(".depth-level-3-0-0-0").Parents(".depth-level").Children("span").Length;

            selector.ExecuteAndGet <long>(Driver).ShouldEqual(3);
        }
Beispiel #7
0
 public void NoElementFoundWithJQuery()
 {
     Driver.FindElement((By)By.jQuery(".no-such-element"));
 }
Beispiel #8
0
 public string CanRetrieveElementBySelectorWithJQuery(string selector)
 {
     return(Driver.FindElement((By)By.jQuery(selector)).Text);
 }
Beispiel #9
0
 public void NoJQueryOnPageThrows()
 {
     Driver.FindElement((By)By.jQuery(".root-marker"));
 }
        public void ByJQueryBuildsSelector()
        {
            string selector = By.jQuery(".test").Statement;

            selector.ShouldEqual("$(\".test\")");
        }
 public void JQueryByCanBeImplicitlyCastToSeleniumBy()
 {
     OpenQA.Selenium.By implicitCast = By.jQuery(".test");
     implicitCast.ShouldNotBeNull();
     implicitCast.ShouldBeOfType <JavaScriptBy>();
 }