本文整理汇总了C#中ILogger.?.INFO方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.?.INFO方法的具体用法?C# ILogger.?.INFO怎么用?C# ILogger.?.INFO使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILogger
的用法示例。
在下文中一共展示了ILogger.?.INFO方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Navigate
public void Navigate(string url, ILogger log)
{
try
{
log?.INFO($"Start URL navigating: {url}");
_container.Value.Driver.Navigate().GoToUrl(url);
log?.INFO("URL navigating completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during URL {url} navigating");
throw new CommandAbortException($"Error occurred during URL {url} navigating", ex);
}
}
示例2: JSExecutor
public void JSExecutor(string jsScript, ILogger log)
{
try
{
log?.INFO($"Execute javascript");
_container.Value.JavaScriptExecutor.ExecuteScript(jsScript);
log?.INFO("Javascript executing completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during javascript execution");
throw new CommandAbortException($"Error occurred during javascript execution:\n{jsScript}", ex);
}
}
示例3: Quit
public void Quit(ILogger log)
{
try
{
log?.INFO($"Start driver quitting");
_container.Value.Driver.Quit();
log?.INFO("Driver quitting completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during driver quitting");
throw new CommandAbortException($"Error occurred during driver quitting", ex);
}
}
示例4: DismissAlert
public void DismissAlert(ILogger log)
{
try
{
log?.INFO($"Dismiss alert");
IAlert alert = _container.Value.Driver.SwitchTo().Alert();
alert.Dismiss();
log?.INFO("Alert dismissing completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during alert dismissing");
throw new CommandAbortException($"Error occurred during alert dismissing", ex);
}
}
示例5: ActionsDragAndDrop
public void ActionsDragAndDrop(WebElement source, WebElement target, ILogger log)
{
var eSource = Find(source, log);
var eTarget = Find(target, log);
try
{
log?.INFO($"Actions drag from {source.Name} to {target.Name}");
new Actions(_container.Value.Driver).MoveToElement(eSource).ClickAndHold(eSource).MoveToElement(eTarget).Release(eTarget).Build().Perform();
log?.INFO("Actions drag and drop completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during actions drag and drop: from {source.Name} to {target.Name}");
throw new CommandAbortException($"Error occurred during actions drag and drop: from {source.Name} to {target.Name}", ex);
}
}
示例6: ActionsMoveTo
public void ActionsMoveTo(WebElement element, ILogger log)
{
var el = Find(element, log);
WaitUntilElementIsVisible(el, log);
WaitUntilElementIsEnabled(el, log);
try
{
log?.INFO($"Move to element: {element.Name}");
new Actions(_container.Value.Driver).MoveToElement(el).Build().Perform();
log?.INFO("Move to completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred moving to element: {element.Name}");
throw new CommandAbortException($"Error occurred moving to element: {element.Name}", ex);
}
}
示例7: ActionsDoubleClick
public void ActionsDoubleClick(WebElement element, ILogger log)
{
var el = Find(element, log);
WaitUntilElementIsVisible(el, log);
WaitUntilElementIsEnabled(el, log);
try
{
log?.INFO($"Actions double click on element: {element.Name}");
new Actions(_container.Value.Driver).DoubleClick(el).Build().Perform();
log?.INFO("Actions double click completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during actions double-clicking on element: {element.Name}");
throw new CommandAbortException($"Error occurred actions during-clicking on element: {element.Name}", ex);
}
}
示例8: Click
public void Click(WebElement element, ILogger log)
{
var el = Find(element, log);
WaitUntilElementIsVisible(el, log);
WaitUntilElementIsEnabled(el, log);
try
{
log?.INFO($"Click on element: {element.Name}");
el.Click();
log?.INFO("Click completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during clicking on element: {element.Name}");
throw new CommandAbortException($"Error occurred during clicking on element: {element.Name}", ex);
}
}
示例9: SendKeys
public void SendKeys(WebElement element, string value, ILogger log)
{
var el = Find(element, log);
WaitUntilElementIsVisible(el, log);
WaitUntilElementIsEnabled(el, log);
try
{
log?.INFO($"Send keys '{value}' to element: {element.Name}");
el.Click();
el.Clear();
el.SendKeys(value);
log?.INFO($"Send keys '{value}' completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during keys '{value}' sending to element: {element.Name}");
throw new CommandAbortException($"Error occurred keys '{value}' sending to element: {element.Name}", ex);
}
}
示例10: 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);
}
}
示例11: ActionsSendKeys
public void ActionsSendKeys(WebElement element, string value, ILogger log)
{
var el = Find(element, log);
WaitUntilElementIsVisible(el, log);
WaitUntilElementIsEnabled(el, log);
try
{
log?.INFO($"Actions send keys to element: {element.Name}");
new Actions(_container.Value.Driver).SendKeys(el, value).Build().Perform();
log?.INFO("Actions send keys completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during actions keys sending to element: {element.Name}");
throw new CommandAbortException($"Error occurred actions keys sending to element: {element.Name}", ex);
}
}
示例12: RightClick
public void RightClick(WebElement element, ILogger log)
{
var el = Find(element, log);
WaitUntilElementIsVisible(el, log);
WaitUntilElementIsEnabled(el, log);
try
{
log?.INFO($"Right click on element: {element.Name}");
new Actions(_container.Value._driver).MoveToElement(el).ContextClick().Build().Perform();
log?.INFO("Right click completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during right-clicking on element: {element.Name}");
throw new CommandAbortException($"Error occurred during right-clicking on element: {element.Name}", ex);
}
}
示例13: SetWindowSize
public void SetWindowSize(int width, int height, ILogger log)
{
try
{
log?.INFO($"Resize window using width: {width} and height: {height}");
_container.Value.Driver.Manage().Window.Size = new Size(width, height);
log?.INFO("Window resizing completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during window resizing");
throw new CommandAbortException($"Error occurred during window resizing", ex);
}
}
示例14: ObjectJSExecutor
public object ObjectJSExecutor(string jsScript, ILogger log)
{
try
{
log?.INFO($"Execute javascript: {jsScript}");
return _container.Value.JavaScriptExecutor.ExecuteScript(jsScript);
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during execution: {jsScript}");
throw new CommandAbortException($"Error occurred during javascript execution:\n{jsScript}", ex);
}
}
示例15: SwitchToNewTab
public void SwitchToNewTab(ILogger log)
{
try
{
log?.INFO($"Switch to new tab");
_container.Value.Driver.SwitchTo().Window(_container.Value.Driver.WindowHandles.Last());
log?.INFO("Switching to new tab completed");
}
catch (Exception ex)
{
log?.ERROR($"Error occurred during tab switching");
throw new CommandAbortException($"Error occurred during tab switching", ex);
}
}