本文整理匯總了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("นิทาน");
//.........這裏部分代碼省略.........