コード例 #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);
        }
コード例 #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");
        }
コード例 #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");
        }
コード例 #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");
        }
コード例 #5
0
        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();
            }
        }
コード例 #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);
        }
コード例 #7
0
 public void NoElementFoundWithJQuery()
 {
     Driver.FindElement((By)By.jQuery(".no-such-element"));
 }
コード例 #8
0
 public string CanRetrieveElementBySelectorWithJQuery(string selector)
 {
     return(Driver.FindElement((By)By.jQuery(selector)).Text);
 }
コード例 #9
0
 public void NoJQueryOnPageThrows()
 {
     Driver.FindElement((By)By.jQuery(".root-marker"));
 }
コード例 #10
0
        public void ByJQueryBuildsSelector()
        {
            string selector = By.jQuery(".test").Statement;

            selector.ShouldEqual("$(\".test\")");
        }
コード例 #11
0
 public void JQueryByCanBeImplicitlyCastToSeleniumBy()
 {
     OpenQA.Selenium.By implicitCast = By.jQuery(".test");
     implicitCast.ShouldNotBeNull();
     implicitCast.ShouldBeOfType <JavaScriptBy>();
 }