예제 #1
0
        private bool SupportsSelectorApi()
        {
            IJavaScriptExecutor javascriptDriver  = driver as IJavaScriptExecutor;
            IFindsByCssSelector cssSelectorDriver = driver as IFindsByCssSelector;

            return((cssSelectorDriver != null) && (javascriptDriver != null) && ((bool)javascriptDriver.ExecuteScript("return document['querySelector'] !== undefined;")));
        }
예제 #2
0
        private bool SupportsSelectorApi()
        {
            IJavaScriptExecutor javascriptDriver  = driver as IJavaScriptExecutor;
            IFindsByCssSelector cssSelectorDriver = driver as IFindsByCssSelector;

            return((cssSelectorDriver != null) && (javascriptDriver != null));
        }
        private static IEnumerable <IWebElement> GetFriendLinks(IFindsByCssSelector driver)
        {
            try
            {
                var divs = driver.FindElementsByCssSelector("._42ft._4jy0.FriendRequestOutgoing.enableFriendListFlyout.outgoingButton.enableFriendListFlyout.hidden_elem._4jy3._517h._51sy");

                return(divs);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
예제 #4
0
        private static IReadOnlyCollection <IWebElement> GetFriendLinks(IFindsByCssSelector driver)
        {
            try
            {
                //var result = driver.FindElementsByCssSelector("._55wo._55x2>._55wq._4g33._5pxa");
                var result = driver.FindElementsByCssSelector(".uiList._262m._4kg>._698");

                return(result);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
예제 #5
0
        static FlowStep CollectionByCss(IFindsByCssSelector parent, string cssSelector) => (Context context) =>
        {
            ReadOnlyCollection <IWebElement> result = null;

            if (!TryUntilSuccess(() =>
            {
                result = parent.FindElementsByCssSelector(cssSelector);

                return(result != null && result.Count > 0); // Satisfied only by non-empty collection
            }))
            {
                return(context.CreateProblem($"{nameof(CollectionByCss)}: '{cssSelector}' failed"));
            }

            return(context.NextContext(result));
        };
예제 #6
0
        static FlowStep ElementByCss(IFindsByCssSelector parent, string cssSelector, int index = 0) => (Context context) =>
        {
            RemoteWebElement child = null;

            if (!TryUntilSuccess(() =>
            {
                child = index == 0 ?
                        parent.FindElementByCssSelector(cssSelector) as RemoteWebElement
                    : parent.FindElementsByCssSelector(cssSelector)[index] as RemoteWebElement;

                return(child != null);
            }))
            {
                return(context.CreateProblem($"{nameof(ElementByCss)}: '{cssSelector}' failed"));
            }

            return(context.NextContext(child));
        };
예제 #7
0
 static bool ExistsByCss(IFindsByCssSelector parent, string selector) => ElementExists(parent.FindElementByCssSelector, selector);
        public IWebElement GetButton(IFindsByCssSelector searchContext, string text)
        {
            var lowerText = text?.Trim()?.ToLower();

            return(searchContext.FindElementsByCssSelector("button")?.FirstOrDefault(b => b.Text.ToLower().Contains(lowerText)));
        }
예제 #9
0
 public AddressBookPage(IWebDriver driver, IFindsByCssSelector cssSelector, IHasInputDevices inputDevices)
 {
     this.driver = driver;
     this.cssSelector = cssSelector;
     this.inputDevices = inputDevices;
 }