本文整理汇总了C#中OpenQA.Selenium.IE.InternetExplorerDriver.FindElementByXPath方法的典型用法代码示例。如果您正苦于以下问题:C# InternetExplorerDriver.FindElementByXPath方法的具体用法?C# InternetExplorerDriver.FindElementByXPath怎么用?C# InternetExplorerDriver.FindElementByXPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQA.Selenium.IE.InternetExplorerDriver
的用法示例。
在下文中一共展示了InternetExplorerDriver.FindElementByXPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMethod1
public void TestMethod1()
{
//RemoteWebDriver Driver = new InternetExplorerDriver();
RemoteWebDriver Driver = new InternetExplorerDriver();
//Driver.Url = "www.football.ua";
Driver.Navigate().GoToUrl(@"http://en.wikipedia.org/");
//Driver.Manage().Window.Maximize();
var lnkSupportUs = Driver.FindElementByCssSelector(@"a[title = 'Support us']");
lnkSupportUs.Click();
// Cannot find with this locator!
var radio50UAH = Driver.FindElementByXPath("/html/body/div[3]/div[2]/div[3]/table/tbody/tr/td[2]/form/div/div[3]/table/tbody/tr[1]/td[1]/label");//Driver.FindElementById("input_amount_0");// Driver.FindElementByCssSelector(@"#input_amount_0[value='50']");
radio50UAH.Click();
var btnDonate = Driver.FindElement(By.ClassName("payment-method-button"));
btnDonate.Click();
var txtFirstName = Driver.FindElementById("fname");
var txtlastName = Driver.FindElementById("lname");
var txtEmail = Driver.FindElementById("emailAdd");
var radioCardType = Driver.FindElementById("cc-visa");
txtFirstName.Clear();
txtFirstName.SendKeys("Vasya");
txtlastName.Clear();
txtlastName.SendKeys("Poopkin");
txtEmail.Clear();
txtEmail.SendKeys("[email protected]");
radioCardType.Click();
var wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(6));
var txtCreditCardNum = Driver.FindElementByName("CREDITCARDNU");
var selectExpMonth = new SelectElement(Driver.FindElementById("F1010_MM"));
var selectExpYear = new SelectElement(Driver.FindElementById("F1010_YY"));
var txtCVV = Driver.FindElementById(@"F1136");
var btnSubmit = Driver.FindElementById(@"btnSubmit");
txtCreditCardNum.Clear();
txtCreditCardNum.SendKeys("8975397698238467");
selectExpMonth.SelectByText("02");
selectExpYear.SelectByText("15");
txtCVV.Clear();
txtCVV.SendKeys("836");
btnSubmit.SendKeys(Keys.Enter);
Driver.SwitchTo().DefaultContent();
// On Donate results page
string headerSelector = @"h1.firstHeading";
var headingElement = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(headerSelector)));
Assert.AreEqual("Donate-error", headingElement.Text);
Driver.Quit();
Driver.Dispose();
}