本文整理汇总了C#中ILogger.?.DEBUG方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.?.DEBUG方法的具体用法?C# ILogger.?.DEBUG怎么用?C# ILogger.?.DEBUG使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILogger
的用法示例。
在下文中一共展示了ILogger.?.DEBUG方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Find
public IWebElement Find(WebElement element, ILogger log)
{
log?.DEBUG($"Start searching element: {element.Name}");
log?.TRACE($"{element}");
try
{
_sw.Value.Reset();
var el = _container.Value._driver.FindElement(element.Locator.Get());
_sw.Value.Stop();
log?.DEBUG($"Element: {element.Name} has been found. Time: {_sw.Value.ElapsedMilliseconds} ms");
return el;
}
catch (Exception ex)
{
log?.ERROR("Couldn't find element");
throw new CommandAbortException("Couldn't find element", ex);
}
}
示例2: WaitUntilElementIsVisible
public void WaitUntilElementIsVisible(IWebElement element, ILogger log)
{
log?.DEBUG("Wait until element is visible");
try
{
_sw.Value.Reset();
WaitUntilElementIsVisible(element);
_sw.Value.Stop();
log?.DEBUG($"Waiting for visibility has been completed. Time: {_sw.Value.ElapsedMilliseconds} ms");
}
catch (Exception ex)
{
log?.ERROR("Waiting for visibility has been completed with exception");
throw new CommandAbortException("Waiting for visibility has been completed with exception", ex);
}
}
示例3: Find
public IWebElement Find(WebElement element, ILogger log)
{
log?.DEBUG($"Start searching element: {element.Name}");
log?.TRACE($"{element}");
try
{
_sw.Value.Start();
var isDefaultContent = true;
IWebElement targetElement = null;
var parentStack = new Stack<WebElement>();
for (var currentElement = element.ParentElement; currentElement != null; currentElement = currentElement.ParentElement)
{
parentStack.Push(currentElement);
}
while (parentStack.Count != 0)
{
var workElement = parentStack.Pop();
var frameElement = workElement as FrameWebElement;
if (frameElement != null)
{
SwitchToFrame(frameElement, log);
isDefaultContent = false;
}
}
if (element.Locator.IsRelative)
{
for (var currentElement = element.ParentElement; currentElement != null && !(currentElement.Locator?.IsRelative ?? false); currentElement = currentElement.ParentElement)
{
var frameElement = currentElement as FrameWebElement;
if (frameElement == null)
parentStack.Push(currentElement);
}
if (parentStack.Count != 0)
{
var currentParent = parentStack.Pop();
log?.TRACE($"Start searching parent element: {currentParent.Name}");
log?.TRACE($"{currentParent}");
targetElement = _container.Value.Driver.FindElement(currentParent.Locator.Get());
log?.TRACE($"Parent element: {currentParent.Name} has been found");
while (parentStack.Count != 0)
{
currentParent = parentStack.Pop();
log?.TRACE($"Start searching target parent element: {currentParent.Name}");
log?.TRACE($"{currentParent}");
targetElement = targetElement.FindElement(currentParent.Locator.Get());
log?.TRACE($"Target parent element: {currentParent.Name} has been found");
}
log?.TRACE($"Start searching target element: {currentParent.Name}");
log?.TRACE($"{element}");
targetElement = targetElement.FindElement(element.Locator.Get());
log?.TRACE($"Target element: {element.Name} has been found");
}
else
{
log?.TRACE($"Start searching target parent element: {element.Name}");
log?.TRACE($"{element}");
targetElement = _container.Value.Driver.FindElement(element.Locator.Get());
log?.TRACE($"Target parent element: {element.Name} has been found");
}
}
else
{
log?.TRACE($"Start searching target element: {element.Name}");
log?.TRACE($"{element}");
targetElement = _container.Value.Driver.FindElement(element.Locator.Get());
log?.TRACE($"Target element: {element.Name} has been found");
}
if (!isDefaultContent) SwitchToDefaultContent(log);
_sw.Value.Stop();
log?.INFO("Click completed");
log?.TRACE($"Element: {element.Name} has been found. Time: {_sw.Value.ElapsedMilliseconds} ms");
return targetElement;
}
catch (Exception ex)
{
log?.ERROR("Couldn't find element");
throw new CommandAbortException($"Couldn't find element: {element.Name}", ex);
}
}
示例4: SwitchToFrameById
public void SwitchToFrameById(string id, ILogger log)
{
try
{
log?.DEBUG($"Switch to frame");
_container.Value.Driver.SwitchTo().Frame(id);
log?.DEBUG($"Switching to frame completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during switching to frame");
throw new CommandAbortException($"Error occurred during switching to frame", ex);
}
}
示例5: SwitchToFrame
public void SwitchToFrame(FrameWebElement elem, ILogger log)
{
try
{
log?.DEBUG($"Switch to frame by locator: {elem}");
var wElem = Find(elem, log);
var frameId = wElem.GetAttribute("id");
_container.Value.Driver.SwitchTo().Frame(frameId);
log?.DEBUG($"Switching to frame completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during switching to frame by locator: {elem}");
throw new CommandAbortException($"Error occurred during switching to frame by locator: {elem}", ex);
}
}
示例6: SwitchToDefaultContent
public void SwitchToDefaultContent(ILogger log)
{
try
{
log?.DEBUG($"Switch to default content");
_container.Value.Driver.SwitchTo().DefaultContent();
log?.DEBUG($"Switching to default content completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during switching to default content");
throw new CommandAbortException($"Error occurred during switching to default content", ex);
}
}