本文整理汇总了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);
//}
}
示例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();
}
示例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);
}
示例4: Check
public static void Check(IWebElement checkbox)
{
if (!IsChecked(checkbox))
{
checkbox.Click();
}
}
示例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();
}
示例6: Execute
protected override void Execute(IWebDriver driver, IWebElement element, CommandDesc command)
{
if (element.Selected)
{
element.Click();
}
}
示例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);
}
}
示例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;
}
示例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();
}
示例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);
}
示例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) };
}
示例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;
}
示例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);
}
示例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]!");
}
示例15: EnterData
public void EnterData(ISearchContext context, IWebElement element, object data)
{
var value = (bool)data;
var isChecked = IsChecked(element);
if (value != isChecked)
{
element.Click();
}
}