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


C# IWebElement.FindElement方法代码示例

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


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

示例1: Link4VehicleVariant

 public Link4VehicleVariant(IWebElement variant)
 {
     _version = variant.FindElement(By.XPath("div/div[1]/span/label")).Text;
     _volume = variant.FindElement(By.XPath("div/div[2]")).Text;
     _power = variant.FindElement(By.XPath("div/div[3]")).Text;
     _body = variant.FindElement(By.XPath("div/div[4]")).Text;
 }
开发者ID:maciejpitucha,项目名称:taryfy_cs,代码行数:7,代码来源:Link4VehicleVariant.cs

示例2: ParseSpecDetail

 static SpecDetail ParseSpecDetail(IWebElement specDetail)
 {
     return new SpecDetail
     {
         Id = specDetail.FindElement(By.CssSelector("a.description")).GetAttribute("href"),
         Message = specDetail.FindElement(By.CssSelector(".resultMessage")).Text,
     };
 }
开发者ID:Sqdw,项目名称:SQUnit,代码行数:8,代码来源:JasmineTestSuite.cs

示例3: FindElement

        public static IWebElement FindElement(this IWebDriver driver, By @by, IWebElement parent, int timeoutInSeconds)
        {
            if (timeoutInSeconds > 0)
            {
                var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds));
                return wait.Until(drv => parent.FindElement(by));
            }

            return parent.FindElement(by);
        }
开发者ID:erikojebo,项目名称:seleniumshield,代码行数:10,代码来源:WebDriverExtensions.cs

示例4: GetTestResultFromTestOutPut

        private static ITestResult GetTestResultFromTestOutPut(IWebElement testOutput)
        {
            var testResult = new TestResult();
            var classAttribute = testOutput.GetAttribute("class");
            var moduleName = testOutput.FindElement(By.ClassName("module-name")).Text.Trim();
            var testName = testOutput.FindElement(By.ClassName("test-name")).Text.Trim();
            var testMessages = GetAggregatedQunitAssertMessages(testOutput);

            testResult.Result = classAttribute.Equals("pass") ? UnitTestResult.Passed : UnitTestResult.Failed;
            testResult.Message = testMessages;
            testResult.TestName = string.Format("{0} : {1}", moduleName, testName);

            return testResult;
        }
开发者ID:JohnBrod,项目名称:Bolt,代码行数:14,代码来源:QUnitTestResultCollector.cs

示例5: SetDesiredTemp

 internal void SetDesiredTemp(IWebElement thermostatRow, double temp)
 {
     var xPath = XPath.ThermostatDesiredTempInput();
     var inputField = thermostatRow.FindElement(xPath);
     inputField.Clear();
     inputField.SendKeys(temp.ToString());
 }
开发者ID:RussPAll,项目名称:FhemDotNet,代码行数:7,代码来源:Index.cs

示例6: GetTableBody

        private static IEnumerable<Row> GetTableBody(IWebElement tableElement)
        {
            var bodyElement = tableElement.FindElement(By.TagName("tbody"));
            var bodyRows = bodyElement.FindElements(By.TagName("tr"));

            var rows = new List<Row>();

            for (int rowIndex = 0; rowIndex < bodyRows.Count; rowIndex++)
            {
                var bodyRow = bodyRows[rowIndex];
                var cells = bodyRow.FindElements(By.TagName("td"));

                var row = new Row { Index = rowIndex };

                for (int columnIndex = 0; columnIndex < cells.Count; columnIndex++)
                {
                    var cell = cells[columnIndex];
                    row.Cells.Add(new Cell { ColumnId = columnIndex, Value = cell.Text, WebElement = cell });
                }

                rows.Add(row);
            }

            return rows;
        }
开发者ID:endjin,项目名称:Endjin.SpecFlow.Selenium,代码行数:25,代码来源:WebElementExtensions.cs

示例7: OpenInNewTab

 public static void OpenInNewTab(IWebElement item)
 {
     var url = item.FindElement(By.TagName("a"));
     url.SendKeys(Keys.Control + Keys.Return);
     url.SendKeys(Keys.Control + Keys.Tab);
     Cons.driver.SwitchTo().Window(Cons.driver.WindowHandles[Cons.driver.WindowHandles.Count - 1]);
 }
开发者ID:Polivando,项目名称:Rozetka,代码行数:7,代码来源:Cons.cs

示例8: Table

        protected List<IWebElement> _tableRows; //List of all the rows to loop through to look for matches.

        #endregion Fields

        #region Constructors

        public Table(IWebElement table)
        {
            try
            {
                //Look for and assign the tbody element
                _tableBody = table.FindElement(By.TagName("tbody"));
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Couldn't find a tbody tag for this table. {0}", ex.Message));
            }

            try
            {
                //Look for all the table headers
                _tableHeaders = table.FindElements(By.TagName("th")).ToList();
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("Couldn't find any th tags within this table. {0}", ex.Message));
            }

            try
            {
                //Look for all the table rows
                _tableRows = _tableBody.FindElements(By.TagName("tr")).ToList();
            }
            catch (Exception ex)
            {
                throw new Exception(string.Format("This table doesn't contain any rows. {0}", ex.Message));
            }
        }
开发者ID:FriendlyTester,项目名称:Table-ControlObject,代码行数:38,代码来源:TableControlObject.cs

示例9: extractListing

        private Listing extractListing(IWebElement iWebElement)
        {
            var listing = new Listing();

            try
            {
                //listing.Publish = iWebElement.FindElement(By.CssSelector("span time")).Text;
                //listing.Title = iWebElement.FindElement(By.CssSelector("span a")).Text;
                listing.Price = iWebElement.FindElement(PriceBy).Text.Replace("$", "").Replace(",", "");
                //string raw = iWebElement.FindElement(By.CssSelector("span span.housing"))
                //    .Text.Replace('/', ' ')
                //    .Replace(" ", "");
                //listing.Bed = raw.Split('-')[0].Replace("br", "");
                var sqft = iWebElement.FindElement(SqFtBy).Text.Replace(",", "").Trim();
                if (string.IsNullOrEmpty(sqft))
                    sqft = "0";
                listing.Sqft = sqft;
                listing.Address = iWebElement.FindElement(Address).GetAttribute("title").Replace(",", "");
                return listing;

            }
            catch (Exception)
            {
                return listing;
            }
        }
开发者ID:rcasady616,项目名称:RealEstate,代码行数:26,代码来源:SearchPage.cs

示例10: ParseTestResult

        TestResult ParseTestResult(IWebElement testOutput)
        {
            var testName = testOutput.FindElement(By.ClassName("test-name")).Text;
            var resultClass = testOutput.GetAttribute("class");

            if (resultClass == "pass")
                return CreateTestResult(testName, true, string.Empty);

            if (resultClass == "fail")
                return CreateTestResult(testName, false, testOutput.FindElement(By.ClassName("fail")).Text);

            if (resultClass == "running")
                return CreateTestResult(testName, false, "The test did not finish within time limit.");

            return CreateTestResult(testName, false, "Unknown test class: '" + resultClass + "'");
        }
开发者ID:Sqdw,项目名称:SQUnit,代码行数:16,代码来源:QUnitTestSuite.cs

示例11: LocateAssertMessage

		public string LocateAssertMessage(IWebElement fromElement) {
			try { 
				return fromElement.FindElement(By.ClassName("test-message")).Text;
			}
			catch(NoSuchElementException) {
				return "";
			}
		}
开发者ID:amg-argh,项目名称:Amg.UnitTests.JsRunner,代码行数:8,代码来源:QUnitElementLocator.cs

示例12: LocateAssertSource

		public string LocateAssertSource(IWebElement fromElement) {
			try { 
				return fromElement.FindElement(By.CssSelector(".test-source pre")).Text;
			}
			catch(NoSuchElementException) {
				return "";
			}
		}
开发者ID:amg-argh,项目名称:Amg.UnitTests.JsRunner,代码行数:8,代码来源:QUnitElementLocator.cs

示例13: SelectComboBox

        public static void SelectComboBox(IWebElement element, string id, int numDown)
        {
            IWebElement selectBox = element.FindElement(By.Id(id));

            for (int i = 0; i > numDown; i++)
            {
                selectBox.SendKeys(Keys.Down);
            }
        }
开发者ID:BrockFredin,项目名称:SeleniumLW,代码行数:9,代码来源:ComboBox.cs

示例14: ExpandMenu

        private static IWebElement ExpandMenu(IWebElement block, IWebElement menu)
        {
            if (!IsExpanded(block))
            {
                block.FindElement(By.CssSelector("[class*='ui-selectmenu-button']")).FindElement(By.CssSelector("[class*='ui-icon']")).Click();
            }

            return menu.FindElement(By.CssSelector("[class*='ui-selectmenu-menu'][class*='selectmenu-open']"));
        }
开发者ID:jar11,项目名称:automation,代码行数:9,代码来源:SelectMenu.cs

示例15: GetTableHeaders

        private static IEnumerable<Column> GetTableHeaders(IWebElement tableElement)
        {
            var headElement = tableElement.FindElement(By.TagName("thead"));

            var headRow = headElement.FindElement(By.TagName("tr"));
            var headCells = headRow.FindElements(By.TagName("th"));

            return headCells.Select((headCell, index) => new Column { Id = index, Index = index, Name = headCell.Text });
        }
开发者ID:endjin,项目名称:Endjin.SpecFlow.Selenium,代码行数:9,代码来源:WebElementExtensions.cs


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