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


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

本文整理汇总了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);
     }
 }
开发者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: 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);
     }
 }
开发者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: 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);
            }
        }
开发者ID:IIITanbI,项目名称:2,代码行数:19,代码来源:WebDriverManagerActions.cs

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

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

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

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

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

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

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

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

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


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