本文整理汇总了C#中OpenQA.Selenium.IE.InternetExplorerDriver.FindElementByTagName方法的典型用法代码示例。如果您正苦于以下问题:C# InternetExplorerDriver.FindElementByTagName方法的具体用法?C# InternetExplorerDriver.FindElementByTagName怎么用?C# InternetExplorerDriver.FindElementByTagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenQA.Selenium.IE.InternetExplorerDriver
的用法示例。
在下文中一共展示了InternetExplorerDriver.FindElementByTagName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestBookSearch
public void TestBookSearch()
{
//First step is browse to website and go to search page.
System.IO.File.WriteAllText("result.txt","");
driver = new InternetExplorerDriver();
driver.Manage().Window.Maximize();
driver.Navigate().GoToUrl("paratabplus.cloudapp.net");
driver.FindElementByClassName("menulist").FindElement(By.CssSelector("li a[href=\"/BookSearch/\"]")).Click();
Assert.AreEqual("Search", driver.Title);
IWebElement form;
//-----------------------------------
/* Next step is find book from define keywords then submit
* measure time from result that display in grey character on find result(if search result is found.)
* record it and use these measure data to summarize.
*/
driver.FindElementByName("Keyword").Clear();
driver.FindElementByName("Keyword").SendKeys("COM-FL2-2812");
driver.FindElementByTagName("select").Click();
driver.Keyboard.SendKeys(Keys.Down);
driver.Keyboard.SendKeys(Keys.Enter);
form = driver.FindElementByCssSelector("form[action=\"/BookSearch/Basic\"]");
form.Submit();
AssertSearchResult("Call no:COM-FL2-2812");
driver.FindElementByName("Keyword").Clear();
driver.FindElementByName("Keyword").SendKeys("Computer");
driver.FindElementByTagName("select").Click();
driver.Keyboard.SendKeys(Keys.Down);
driver.Keyboard.SendKeys(Keys.Enter);
form = driver.FindElementByCssSelector("form[action=\"/BookSearch/Basic\"]");
form.Submit();
AssertSearchResult("Bookname:Computer");
driver.FindElementByName("Keyword").Clear();
driver.FindElementByName("Keyword").SendKeys("James");
driver.FindElementByTagName("select").Click();
driver.Keyboard.SendKeys(Keys.Down);
driver.Keyboard.SendKeys(Keys.Enter);
form = driver.FindElementByCssSelector("form[action=\"/BookSearch/Basic\"]");
form.Submit();
AssertSearchResult("Author:James");
driver.FindElementByName("Keyword").Clear();
driver.FindElementByName("Keyword").SendKeys("shogakukan");
driver.FindElementByTagName("select").Click();
driver.Keyboard.SendKeys(Keys.Down);
driver.Keyboard.SendKeys(Keys.Enter);
form = driver.FindElementByCssSelector("form[action=\"/BookSearch/Basic\"]");
form.Submit();
AssertSearchResult("Publisher:shogakukan");
driver.FindElementByName("Keyword").Clear();
driver.FindElementByName("Keyword").SendKeys("1995");
driver.FindElementByTagName("select").Click();
driver.Keyboard.SendKeys(Keys.Down);
driver.Keyboard.SendKeys(Keys.Enter);
form = driver.FindElementByCssSelector("form[action=\"/BookSearch/Basic\"]");
form.Submit();
AssertSearchResult("Year:1995");
//-----------------------------------
driver.FindElementByCssSelector("input[type=\"text\"][name=\"CallNumber\"]").SendKeys("NOV");
driver.FindElementByCssSelector("form input[placeholder=\"Book name\"]").SendKeys("Sword Art Online Aincrad");
driver.FindElementByCssSelector("form input[placeholder=\"Author\"]").SendKeys("Reki Kawahara");
driver.FindElementByCssSelector("form input[placeholder=\"Publisher\"]").SendKeys("Zenshu");
driver.FindElementByCssSelector("form[action=\"/BookSearch/Advance\"] input[type=\"submit\"]").Click();
AssertSearchResult("\r\nCall no:NOV\r\nBookname:Sword Art Online Aincrad\r\nAuthor:Reki Kawahara\r\n" +
"Publisher:Zenshu\r\nYear:null");
driver.FindElementByCssSelector("input[type=\"text\"][name=\"CallNumber\"]").Clear();
driver.FindElementByCssSelector("input[type=\"text\"][name=\"CallNumber\"]").SendKeys("PE-FL1-0005");
driver.FindElementByCssSelector("form input[placeholder=\"Book name\"]").Clear();
driver.FindElementByCssSelector("form input[placeholder=\"Book name\"]").SendKeys("Football training");
driver.FindElementByCssSelector("form input[placeholder=\"Author\"]").Clear();
driver.FindElementByCssSelector("form input[placeholder=\"Author\"]").SendKeys("Graham Taylor");
driver.FindElementByCssSelector("form input[placeholder=\"Publisher\"]").Clear();
driver.FindElementByCssSelector("form input[placeholder=\"Publisher\"]").SendKeys("Leopard Books");
driver.FindElementByCssSelector("form input[placeholder=\"Year\"]").Clear();
driver.FindElementByCssSelector("form input[placeholder=\"Year\"]").SendKeys("1995");
driver.FindElementByCssSelector("form[action=\"/BookSearch/Advance\"] input[type=\"submit\"]").Click();
AssertSearchResult("\r\nCall no:PE-FL1-0005\r\nBookname:Football training\r\nAuthor:Graham Taylor\r\n" +
"Publisher:Leopard Books\r\nYear:1995");
driver.FindElementByCssSelector("input[type=\"text\"][name=\"CallNumber\"]").Clear();
driver.FindElementByCssSelector("input[type=\"text\"][name=\"CallNumber\"]").SendKeys("MAT");
driver.FindElementByCssSelector("form input[placeholder=\"Book name\"]").Clear();
driver.FindElementByCssSelector("form input[placeholder=\"Book name\"]").SendKeys("Theory of computation");
driver.FindElementByCssSelector("form input[placeholder=\"Author\"]").Clear();
driver.FindElementByCssSelector("form input[placeholder=\"Author\"]").SendKeys("รศ.ดร.เกียรติกูล เจียรนัยธนะกิจ");
driver.FindElementByCssSelector("form input[placeholder=\"Publisher\"]").Clear();
driver.FindElementByCssSelector("form input[placeholder=\"Year\"]").Clear();
driver.FindElementByCssSelector("form input[placeholder=\"Year\"]").SendKeys("2009");
driver.FindElementByCssSelector("form[action=\"/BookSearch/Advance\"] input[type=\"submit\"]").Click();
AssertSearchResult("\r\nCall no:MAT\r\nBookname:Theory of computation\r\nAuthor:รศ.ดร.เกียรติกูล เจียรนัยธนะกิจ\r\n" +
"Publisher:null\r\nYear:2009");
driver.FindElementByCssSelector("input[type=\"text\"][name=\"CallNumber\"]").Clear();
driver.FindElementByCssSelector("input[type=\"text\"][name=\"CallNumber\"]").SendKeys("NOV");
driver.FindElementByCssSelector("form input[placeholder=\"Book name\"]").Clear();
driver.FindElementByCssSelector("form input[placeholder=\"Book name\"]").SendKeys("นิทาน");
//.........这里部分代码省略.........