本文整理匯總了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();
}