当前位置: 首页>>代码示例>>C#>>正文


C# ILogger.?.ERROR方法代码示例

本文整理汇总了C#中ILogger.?.ERROR方法的典型用法代码示例。如果您正苦于以下问题:C# ILogger.?.ERROR方法的具体用法?C# ILogger.?.ERROR怎么用?C# ILogger.?.ERROR使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ILogger的用法示例。


在下文中一共展示了ILogger.?.ERROR方法的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);
     }
 }
开发者ID:IIITanbI,项目名称:2,代码行数:14,代码来源:WebDriverManagerBrowser.cs

示例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);
     }
 }
开发者ID:IIITanbI,项目名称:2,代码行数:14,代码来源:WebDriverManagerJS.cs

示例3: Close

 public void Close(ILogger log)
 {
     try
     {
         log?.INFO($"Start driver closing");
         _container.Value.Driver.Close();
         log?.INFO("Driver closing completed");
     }
     catch (Exception ex)
     {
         log?.ERROR($"Error occurred during driver closing");
         throw new CommandAbortException($"Error occurred during driver closing", ex);
     }
 }
开发者ID:IIITanbI,项目名称:2,代码行数:14,代码来源:WebDriverManagerBrowser.cs

示例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);
     }
 }
开发者ID:IIITanbI,项目名称:2,代码行数:15,代码来源:WebDriverManagerBrowser.cs

示例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);
            }
        }
开发者ID:IIITanbI,项目名称:2,代码行数:17,代码来源:WebDriverManagerActions.cs

示例6: 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);
     }
 }
开发者ID:IIITanbI,项目名称:1,代码行数:18,代码来源:WebDriverManager.cs

示例7: 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);
            }
        }
开发者ID:IIITanbI,项目名称:2,代码行数:19,代码来源:WebDriverManager.cs

示例8: 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);
            }
        }
开发者ID:IIITanbI,项目名称:2,代码行数:19,代码来源:WebDriverManagerActions.cs

示例9: WindowMaximize

 public void WindowMaximize(ILogger log)
 {
     try
     {
         log?.INFO($"Maximize window");
         _container.Value.Driver.Manage().Window.Maximize();
         log?.INFO("Window maximizing completed");
     }
     catch (Exception ex)
     {
         log?.ERROR($"Error occurred during window maximizing");
         throw new CommandAbortException($"Error occurred during window maximizing", ex);
     }
 }
开发者ID:IIITanbI,项目名称:2,代码行数:14,代码来源:WebDriverManagerBrowser.cs

示例10: 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);
            }
        }
开发者ID:IIITanbI,项目名称:2,代码行数:19,代码来源:WebDriverManagerActions.cs

示例11: 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);
            }
        }
开发者ID:IIITanbI,项目名称:2,代码行数:18,代码来源:WebDriverManager.cs

示例12: SetWindowSize

 public void SetWindowSize(Size size, ILogger log)
 {
     try
     {
         log?.INFO($"Resize window using size: {size.ToString()}");
         _container.Value.Driver.Manage().Window.Size = size;
         log?.INFO("Window resizing completed");
     }
     catch (Exception ex)
     {
         log?.ERROR($"Error occurred during window resizing");
         throw new CommandAbortException($"Error occurred during window resizing", ex);
     }
 }
开发者ID:IIITanbI,项目名称:2,代码行数:14,代码来源:WebDriverManagerBrowser.cs

示例13: 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);
     }
 }
开发者ID:IIITanbI,项目名称:2,代码行数:13,代码来源:WebDriverManagerJS.cs

示例14: 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);
            }
        }
开发者ID:IIITanbI,项目名称:2,代码行数:90,代码来源:WebDriverManager.cs

示例15: 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);
     }
 }
开发者ID:IIITanbI,项目名称:2,代码行数:14,代码来源:WebDriverManager.cs


注:本文中的ILogger.?.ERROR方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。