本文整理汇总了C#中SearchType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SearchType.ToString方法的具体用法?C# SearchType.ToString怎么用?C# SearchType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchType
的用法示例。
在下文中一共展示了SearchType.ToString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Click
//Attempts to click the element on the page, with specific and default exception handling
public void Click(SearchType type, string text){
try{
if (type == SearchType.Id){
WebDriver.FindElement(By.Id(text)).Click();
}
else if (type == SearchType.LinkText){
WebDriver.FindElement(By.LinkText(text)).Click();
}
else if (type == SearchType.Name){
WebDriver.FindElement(By.Name(text)).Click();
}
else if (type == SearchType.Xpath){
WebDriver.FindElement(By.XPath(text)).Click();
}
else{
System.Console.WriteLine(type.ToString() + " is an unsupported SearchType for this method.");
}
}
catch (NoSuchElementException ex){
System.Console.WriteLine("Error, could not find webElement of type " + type.ToString() + " with id {0}", text);
System.Console.WriteLine(ex.ToString());
return;
}
catch (Exception ex){
System.Console.WriteLine("Unspecified exception in Click().");
System.Console.WriteLine(ex.ToString());
return;
}
}
示例2: RequestSearch
/// <summary>
/// starts a search with the htmlpage
/// </summary>
/// <param name="searchitem">the searchitem as string</param>
/// <param name="searchtype">the type of search "album, tracks..."</param>
/// <returns></returns>
public XmlDocument RequestSearch(string search, SearchType searchType)
{
returnAction("Request Search(" + searchType.ToString() + "):" + search);
XmlDocument doc = new XmlDocument();
if (_serverListItem.Anonymus)
{
search = _serverListItem.Url + "api.php?output=xml&query=" + search + "&search_type=" + searchType.ToString().Replace("SearchType.", "");
}
else
{
search = _serverListItem.Url + "api.php?output=xml&user=" + _serverListItem.User + "&pass=" + _serverListItem.PasswordUnhashed + "&query=" + search + "&search_type=" + searchType.ToString().Replace("SearchType.", "");
}
//startRequest(search, "");
if (startRequest(search, "") != null)
{
doc.Load(startRequest(search, ""));
}
stopRequest();
returnAction("Request Search Completed");
return doc;
}
示例3: SEARCHResponse
/// <summary>
/// SELECT指令查找邮件
/// </summary>
/// <param name="flags"></param>
/// <returns></returns>
public String SEARCHResponse(SearchType searchType)
{
streamWriter.WriteLine("A04 SEARCH " + searchType.ToString());
streamWriter.Flush();
response = readToEnd();
return response;
}
示例4: GetMailHeads
public MailHeadList GetMailHeads(SearchType searchType)
{
return new MailHeadList(imapBase, searchType.ToString());
}
示例5: TextEntry
//Attempts to enter the given text string in a specific element on the page, with specific and default exception handling
public void TextEntry(SearchType type, string searchText, string input)
{
try{
IWebElement textField;
if (type == SearchType.Id){
textField = WebDriver.FindElement(By.Id(searchText));
}
else if (type == SearchType.LinkText){
textField = WebDriver.FindElement(By.LinkText(searchText));
}
else if (type == SearchType.Name){
textField = WebDriver.FindElement(By.Name(searchText));
}
else if (type == SearchType.Xpath){
textField = WebDriver.FindElement(By.XPath(searchText));
}
else{
textField = null;
System.Console.WriteLine(type.ToString() + " is an unsupported SearchType for this method.");
}
textField.Clear();
textField.SendKeys(input);
System.Console.WriteLine("Text '{0}' entered successfully in '{1}'", input, searchText);
}
catch (NoSuchElementException ex){
System.Console.WriteLine("Could not successfully enter text '{0}' in '{1}'", input, searchText);
System.Console.WriteLine(ex.ToString());
return;
}
catch (Exception ex){
System.Console.WriteLine("Unspecified exception in TextEntry().");
System.Console.WriteLine(ex.ToString());
return;
}
}
示例6: Validate
//Just object exists
//Attempts to verify that an element exists on the page, with specific and default exception handling
//Returns the string if found, "" if not found
public string Validate(SearchType type, string text){
try{
string textString;
if (type == SearchType.Id){
textString = WebDriver.FindElement(By.Id(text)).Text;
}
else if (type == SearchType.LinkText){
textString = WebDriver.FindElement(By.LinkText(text)).Text;
}
else if (type == SearchType.Name){
textString = WebDriver.FindElement(By.Name(text)).Text;
}
else if (type == SearchType.Xpath){
textString = WebDriver.FindElement(By.XPath(text)).Text;
}
else{
System.Console.WriteLine(type.ToString() + " is an unsupported SearchType for this method.");
return "";
}
System.Console.WriteLine("{0} '{1}' found", type.ToString(), text);
return textString;
}
catch (NoSuchElementException ex) {
System.Console.WriteLine("Could not successfully find {0} '{1}'", type.ToString(), text);
System.Console.WriteLine(ex.ToString());
return "";
}
catch (Exception ex){
System.Console.WriteLine("Unspecified exception in Validate().");
System.Console.WriteLine(ex.ToString());
return "";
}
}
示例7: GetMailHeaders
public override List<MailHeadModel> GetMailHeaders(SearchType searchType)
{
return GetMailHeaders(searchType.ToString());
}