Ejemplo n.º 1
0
        public void DoWork(object o)
        {
            try
            {
                _task = (WebTask)o;

                OpenBrowser(_task.url);

                IWebElement webElement = null;

                _task.actions.ForEach(action =>
                {
                    try
                    {
                        PerformTaskActions(action, ref webElement);
                    }
                    catch (Exception ex)
                    {
                        Helpers.GetInstance().Logger.Error(ex, $"{ JsonConvert.SerializeObject(_task) }");
                    }
                });

                if (_task.quitBrowserAfter)
                {
                    Quit();
                }

                Helpers.GetInstance().Logger.Info($"Finished - { JsonConvert.SerializeObject(_task) }");
            }
            catch (Exception ex)
            {
                Helpers.GetInstance().Logger.Error(ex, "Internal Error");
            }
        }
Ejemplo n.º 2
0
 public ChromeBrowser(WebTask Task) : base()
 {
     try
     {
         SetDriver(new ChromeDriver(Directory.GetCurrentDirectory()));
         _parentWindowHandle = GetDriver().CurrentWindowHandle;
         GetDriver().SwitchTo().Window(_parentWindowHandle);
     }
     catch (WebDriverException ex)
     {
         throw new System.Exception(ex.Message, ex.InnerException);
     }
 }