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


C# IWebElement.Click方法代码示例

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


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

示例1: ClickWebElement

 public void ClickWebElement(String locator)
 {
     WaitForElementToLoad(locator);
     try
     {
         activeElement = theWebdriver.FindElement(By.Id(locator));
         while (!activeElement.Enabled)
         {
             Thread.Sleep(100);
         }
         activeElement.Click();
     }
     catch (StaleElementReferenceException e)
     {
         ClickWebElement(locator);
     }
     catch (System.InvalidOperationException e)
     {
         ClickWebElement(locator);
     }
     //catch (OpenQA.Selenium.InvalidElementStateException e)
     //{
     //    ClickWebElement(locator);
     //}
 }
开发者ID:nvonop,项目名称:Example,代码行数:25,代码来源:ActionHelper.cs

示例2: NCTDoWork

 public void NCTDoWork()
 {
     driver.Navigate().GoToUrl("http://thptnguyenchithanh.angiang.edu.vn/");
     //wait loading
     element = driver.FindElement(By.CssSelector("div[class='Head title_vis'] a>img[src$='DNN-plus.png']"));
     element.Click();
 }
开发者ID:gaxoimo,项目名称:AutomaticTest,代码行数:7,代码来源:NCTFactory.cs

示例3: ScrollElementAndClick

 public static void ScrollElementAndClick(IWebElement element)
 {
     Thread.Sleep(500);
     ExecuteScript("window.scrollTo(0," + element.Location.Y + ");");
     element.Click();
     Logger.Info(" Scroll Element And Click " + element);
 }
开发者ID:rahulrathore44,项目名称:ParkandCompanyCSharp,代码行数:7,代码来源:JavaScriptExecutorHelper.cs

示例4: Check

 public static void Check(IWebElement checkbox)
 {
     if (!IsChecked(checkbox))
     {
         checkbox.Click();
     }
 }
开发者ID:DarthFubuMVC,项目名称:Serenity,代码行数:7,代码来源:CheckboxHandler.cs

示例5: execute

        protected override void execute(IWebElement element, IDictionary<string, object> cellValues, IStep step, ITestContext context)
        {
            assertCondition(element.Enabled, DisabledElementMessage);
            assertCondition(element.Displayed, HiddenElementMessage);

            element.Click();
        }
开发者ID:jemacom,项目名称:fubumvc,代码行数:7,代码来源:ClickGrammar.cs

示例6: Execute

 protected override void Execute(IWebDriver driver, IWebElement element, CommandDesc command)
 {
     if (element.Selected)
     {
         element.Click();
     }
 }
开发者ID:equilobe,项目名称:SeleneseTestRunner,代码行数:7,代码来源:Uncheck.cs

示例7: EraseData

 public virtual void EraseData(ISearchContext context, IWebElement element)
 {
     if (element.GetAttribute("value").IsNotEmpty())
     {
         element.Click();
         element.SendKeys(Keys.Home + Keys.Shift + Keys.End + Keys.Backspace);
     }
 }
开发者ID:DarthFubuMVC,项目名称:Serenity,代码行数:8,代码来源:TextboxElementHandler.cs

示例8: CredentialElement

 public CredentialElement(IWebDriver driver, IWebElement labelElement)
 {
     Match match = NatwestDriver.PasswordRegex.Match(labelElement.Text);
     labelElement.Click();
     _element = driver.SwitchTo().ActiveElement();
     IsPin = "number".Equals(match.Groups[2].Captures[0].Value);
     _credentialCharIndex = Int32.Parse(match.Groups[1].Captures[0].Value) - 1;
 }
开发者ID:m3zercat,项目名称:BankClient,代码行数:8,代码来源:CredentialElement.cs

示例9: HandleElement

        public void HandleElement(IWebElement el, IWebDriver browser, string[] parameters)
        {
            var targetvalue = parameters[2];

            el.Click();
            IList<IWebElement> comboItems = browser.FindElements(By.CssSelector(".x-boundlist .x-boundlist-item"));
            comboItems.First(item => item.Text.Trim() == targetvalue).Click();
        }
开发者ID:rainymaple,项目名称:WebTester,代码行数:8,代码来源:SelectExtJSCombo.cs

示例10: ButtonTest

 public void ButtonTest()
 {
     element = driver.FindElement(By.XPath("//a[@href='../Posilki/Nazwy']"));
     element.Click();
     driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
     element = driver.FindElement(By.PartialLinkText("cej"));
     element.Click();
     Assert.IsNotNull(element);
 }
开发者ID:dszczutkowski,项目名称:DSMVC,代码行数:9,代码来源:SeleniumTest.cs

示例11: execute

        protected override IEnumerable<CellResult> execute(IWebElement element, StepValues values)
        {
            assertCondition(element.Enabled, DisabledElementMessage);
            assertCondition(element.Displayed, HiddenElementMessage);

            element.Click();

            return new [] { CellResult.Ok(Cell.Key) };
        }
开发者ID:cothienlac86,项目名称:fubumvc,代码行数:9,代码来源:ClickGrammar.cs

示例12: ClickAndWait

 // Click action and wait unitil field selector returns an element 
 public static IWebElement ClickAndWait(this SafeWebDriverWait wait, IWebElement action, string fieldSelector, int delay = 0) {
     if (delay > 0) {
         Thread.Sleep(delay);
     }
     action.Click();
     IWebElement field = null;
     wait.Until(wd => (field = wd.FindElement(By.CssSelector(fieldSelector))) != null);
     Assert.IsNotNull(field);
     return field;
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:11,代码来源:SeHelpers.cs

示例13: ClickAndWaitGone

 // Click action and wait until field selector stops returning an element 
 // must exist before action is invoked
 public static void ClickAndWaitGone(this SafeWebDriverWait wait, IWebElement action, string fieldSelector, int delay = 0) {
     if (delay > 0) {
         Thread.Sleep(delay);
     }
     IWebElement field = wait.Driver.FindElement(By.CssSelector(fieldSelector));
     Assert.IsNotNull(field);
     action.Click();
     wait.Until(wd => (field = SafeFunc(() => wd.FindElement(By.CssSelector(fieldSelector)))) == null);
     Assert.IsNull(field);
 }
开发者ID:Robin--,项目名称:NakedObjectsFramework,代码行数:12,代码来源:SeHelpers.cs

示例14: LogoutTest

 public void LogoutTest()
 {
     Login();
     element = driver.FindElement(By.PartialLinkText("Log"));
     element.Click();
     driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
     element = driver.FindElement(By.Id("loginLink"));
     string s = element.Text;
     Assert.AreNotEqual(s, "Witaj [email protected]!");
 }
开发者ID:dszczutkowski,项目名称:DSMVC,代码行数:10,代码来源:SeleniumTest.cs

示例15: EnterData

        public void EnterData(ISearchContext context, IWebElement element, object data)
        {
            var value = (bool)data;

            var isChecked = IsChecked(element);

            if (value != isChecked)
            {
                element.Click();
            }
        }
开发者ID:kharlamov,项目名称:Serenity,代码行数:11,代码来源:CheckboxHandler.cs


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