当前位置: 首页>>代码示例>>C#>>正文


C# IWebDriver.FirstOrDefault方法代码示例

本文整理汇总了C#中IWebDriver.FirstOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# IWebDriver.FirstOrDefault方法的具体用法?C# IWebDriver.FirstOrDefault怎么用?C# IWebDriver.FirstOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWebDriver的用法示例。


在下文中一共展示了IWebDriver.FirstOrDefault方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDeleteButton

        internal static IWebElement GetDeleteButton(IWebDriver driver)
        {
            var elem = driver.FirstOrDefault(By.CssSelector("#DeleteMessages"));

            if (elem == null || !elem.Displayed)
            {
                elem = driver.FirstOrDefault(By.CssSelector("[title^='Delete (Del)']"));
            }

            return elem;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:11,代码来源:HotmailElementFinder.cs

示例2: GetForwardButton

        public static IWebElement GetForwardButton(IWebDriver driver)
        {
            var elem = driver.FirstOrDefault(By.CssSelector("#Forward"));

            if (elem == null || !elem.Displayed)
            {
                elem = driver.FirstOrDefault(By.CssSelector("[aria-label^='Forward (SHIFT-F)']"));
            }

            return elem;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:11,代码来源:HotmailElementFinder.cs

示例3: GetReplyButton

        internal static IWebElement GetReplyButton(IWebDriver driver)
        {
            var elem = driver.FirstOrDefault(By.CssSelector("#Reply"));

            if (elem == null || !elem.Displayed)
            {
                elem = driver.FirstOrDefault(By.CssSelector("[aria-label^='Reply (R)']"));
            }

            return elem;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:11,代码来源:HotmailElementFinder.cs

示例4: GetPreviewPane

 public static IWebElement GetPreviewPane(IWebDriver driver)
 {
     try
     {
         return driver.FirstOrDefault(By.Id("ReadMessageScrollableSection"));
     }
     catch (Exception)
     {
         return driver.FirstOrDefault(By.CssSelector(".conductorContent > div > div > .scrollContainer"));
     }
 }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:11,代码来源:HotmailElementFinder.cs

示例5: GetReplyMenuElement

        public static IWebElement GetReplyMenuElement(IWebDriver driver)
        {
            var elem = driver.FirstOrDefault(By.CssSelector("[title='More reply commands']"));

            if (elem == null || !elem.Displayed)
            {
                elem = driver.FirstOrDefault(By.CssSelector("[title='More ways to reply']"));
            }

            return elem;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:11,代码来源:HotmailElementFinder.cs

示例6: GetMessageBodyElement

        internal static IWebElement GetMessageBodyElement(IWebDriver driver)
        {
            var elem = driver.FirstOrDefault(By.CssSelector(".readMsgBody"));

            if (elem == null || !elem.Displayed)
            {
                var msgBody = driver.FirstOrDefault(By.CssSelector("[aria-label^='Message Body']"));

                if (msgBody != null)
                {
                    elem = msgBody.FindParent();
                }
            }

            return elem;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:16,代码来源:HotmailElementFinder.cs

示例7: OpeningItem

        public virtual void OpeningItem(IWebDriver wd, Logger logger)
        {
            var eventArgs = new DOMEventArgs(wd, logger);
            OnOpeningItem(this, eventArgs);

            if (eventArgs.ShouldCancelNavigation)
            {
                return;
            }

            var link = wd.FirstOrDefault(By.CssSelector(this.LocationCriteria));
            
            if (link == null || !link.IsDisplayed())
            {
                logger.Info("Couldn't find Element to Engage Alternate Activity for: {0}", Key);
                return;
            }

            link.Click();
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:20,代码来源:DOMActivatorElement.cs

示例8: GetUnblockContentElement

        internal static IWebElement GetUnblockContentElement(IWebDriver driver)
        {
            var elem = driver.FirstOrDefault(By.XPath("//a[contains(text(), 'Show content')]"));

            if (elem == null || !elem.Displayed)
            {
                elem = driver.FirstOrDefault(By.CssSelector("a > span"), e => e.Text.ToLower().Contains("show blocked content"));
            }

            return elem;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:11,代码来源:HotmailElementFinder.cs

示例9: GetJunkFolderElement

        public static IWebElement GetJunkFolderElement(IWebDriver driver)
        {
            var selectionLogic = new Func<IWebElement>[]
            {
                () => driver.FirstOrDefault(By.CssSelector("[title^='Junk Email']")),
                () => driver.FirstOrDefault(By.CssSelector("[title^='Junk']"))
            };

            foreach (var f in selectionLogic)
            {
                try
                {
                    var junk = f();

                    if (junk != null)
                    {
                        return junk;
                    }
                }
                catch (Exception) { }
            }

            return null;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:24,代码来源:HotmailElementFinder.cs

示例10: GetInboxFolderElement

        public static IWebElement GetInboxFolderElement(IWebDriver driver)
        {
            var selectionLogic = new Func<IWebElement>[]
            {
                () => driver.FirstOrDefault(By.CssSelector("[title^='Inbox']"))
            };

            foreach (var f in selectionLogic)
            {
                try
                {
                    var inbox = f();

                    if (inbox != null)
                    {
                        return inbox;
                    }
                }
                catch (Exception) { }
            }

            return null;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:23,代码来源:HotmailElementFinder.cs

示例11: GetShowBlockedElement

        public static IWebElement GetShowBlockedElement(IWebDriver driver)
        {
            var elem = driver.FirstOrDefault(By.XPath("//a[contains(text(), 'Let me check')]"));

            if (elem == null || !elem.Displayed)
            {
                elem = GetPreviewPane(driver).FirstOrDefault(By.CssSelector(".scrollContainer a > span"), e => e.Text.ToLower() == "show blocked content");
            }

            return elem;
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:11,代码来源:HotmailElementFinder.cs

示例12: GetUnJunkElement

 public static IWebElement GetUnJunkElement(IWebDriver driver)
 {
     try
     {
         return driver.FirstOrDefault(By.ClassName("sfUnjunkItems"));
     }
     catch (Exception)
     {
         return GetPreviewPane(driver).FirstOrDefault(By.CssSelector(".scrollContainer a > span"), e => e.Text.ToLower() == "it's not spam");
     }
 }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:11,代码来源:HotmailElementFinder.cs


注:本文中的IWebDriver.FirstOrDefault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。