예제 #1
0
        public void Click(IWebElement item, string elementDescription, ClickSetting _clickSetting, Direction scrollFirst = Direction.Up)
        {
            int     countr  = 0;
            Clicker clicker = new Clicker(driv, _clickSetting);

            clicker.Click(item, elementDescription, scrollFirst);
        }
예제 #2
0
        public WebElem(TestContext context)
        {
            int _PageTimeout;
            int _PollInterval;

            _PageTimeout  = Convert.ToInt32(context.GetTimeOut());
            _PollInterval = Convert.ToInt32(context.GetPollIntervalInMilliseconds());

            clickSetting = new ClickSetting()
            {
                PageTimeout = TimeSpan.FromSeconds(_PageTimeout), PollInterval = TimeSpan.FromMilliseconds(_PollInterval)
            };
            typeSetting = new TypeSetting()
            {
                PageTimeout = TimeSpan.FromSeconds(_PageTimeout), PollInterval = TimeSpan.FromMilliseconds(_PollInterval)
            };

            lines = new List <LogItem>();
            lines.Add(new LogItem {
                LogLevel = loglevel.always, LogMessage = string.Format("Start Logging for test {0}", NUnit.Framework.TestContext.CurrentContext.Test.Name)
            });
            RunID = Convert.ToString(Guid.NewGuid());

            foreach (var ll in context.GetLogLevel().Split(','))
            {
                LogLevels.Add(ll.Trim().ToLower());
            }
        }
예제 #3
0
        public void Click(IWebElement item, ClickSetting click)
        {
            countr = 0;
            bool didItWork = false;

            element         = item;
            aTimer          = new System.Timers.Timer();
            aTimer.Interval = click.PollInterval.TotalMilliseconds;
            aTimer.Elapsed += TimedClickOnWebElement;
            aTimer.Enabled  = true;
            while (aTimer.Enabled == true)
            {
                if (countr > click.MaxPollCount && WasSuccessful == false)
                {
                    didItWork = false;
                }
                else if (countr <= click.MaxPollCount || WasSuccessful == true)
                {
                    didItWork = true;
                }
            }
            aTimer.Dispose();
            didItWork.Should().BeTrue();
            countr = 0;
        }
예제 #4
0
 public Clicker(IWebDriver driv, ClickSetting clickSetting)
 {
     countr        = 0;
     _driver       = driv;
     _clickSetting = clickSetting;
     WasSuccessful = false;
     aTimer        = new System.Timers.Timer();
     we            = new WebElem(_driver, _clickSetting);
 }
예제 #5
0
        public void Click(by ByString, ClickSetting click)
        {
            var wait = new WebDriverWait(driv, click.PageTimeout);

            wait.Until(driver => driv.FindElement(ByString));
            scrollintoView(driv.FindElement(ByString));
            IWebElement item = driv.FindElement(ByString);

            Click(item, ByString.Description);
        }
예제 #6
0
        public void Click(By ByString, ClickSetting click)
        {
            var wait = new WebDriverWait(driver, click.PageTimeout);

            wait.Until(driver => driver.FindElement(ByString));

            IWebElement item = driver.FindElement(ByString);

            Click(item, click);
        }
예제 #7
0
        public void SetCheckBox(by CheckBox, bool ShouldBeChecked, ClickSetting clickSetting)
        {
            var wait = new WebDriverWait(driv, clickSetting.PageTimeout);

            wait.Until(driver => driv.FindElement(CheckBox));

            bool IsCurrentlyChecked = Convert.ToBoolean(GetValue(CheckBox));

            if (IsCurrentlyChecked != ShouldBeChecked)
            {
                Click(CheckBox, clickSetting);
            }
        }
예제 #8
0
        public void Click(by Parent, string XpathToClick, ClickSetting click)
        {
            var wait  = new WebDriverWait(driv, click.PageTimeout);
            var wait2 = new WebDriverWait(driv, click.PageTimeout);

            wait.Until(driver => driv.FindElement(Parent));
            IWebElement Par = driv.FindElement(Parent);

            wait2.Until(driver => Par.FindElement(By.XPath(XpathToClick)));
            scrollintoView(Par.FindElement(By.XPath(XpathToClick)));
            IWebElement item = Par.FindElement(By.XPath(XpathToClick));

            Click(item, string.Format("The child at xpath='{0}' of Parent = '{1}'", XpathToClick, Parent.Description));
        }
예제 #9
0
        public MapViewModel()
        {
            boothMap = new BoothMap();
            overlay  = new DrawingGroup();
            baseMap  = new ImageDrawing();
            DrawingGroup mapDrawing = new DrawingGroup();

            mapDrawing.Children.Add(baseMap);
            mapDrawing.Children.Add(overlay);
            drawnBooths   = new HashSet <BoothWrapper>();
            this.mapImage = new DrawingImage(mapDrawing);
            this.populateFromModel();
            this.clickSetting = ClickSetting.Add;
        }
예제 #10
0
        public Browser(TestContext context)
        {
            runMode                = context.GetRunMode();
            browserType            = context.GetBrowserType();
            KillTheBrowserAtTheEnd = context.GetKillBrowser();
            env           = context.GetEnvironment();
            headless      = context.GetHeadless();
            application   = context.GetApplication();
            runID         = context.GetCycleID();
            logLevel      = context.GetLogLevel();
            _PageTimeout  = Convert.ToInt32(context.GetTimeOut());
            _PollInterval = Convert.ToInt32(context.GetPollIntervalInMilliseconds());

            _clickSetting = new ClickSetting()
            {
                PageTimeout = TimeSpan.FromSeconds(_PageTimeout), PollInterval = TimeSpan.FromMilliseconds(_PollInterval)
            };
            _typeSetting = new TypeSetting()
            {
                PageTimeout = TimeSpan.FromSeconds(_PageTimeout), PollInterval = TimeSpan.FromMilliseconds(_PollInterval)
            };
        }
예제 #11
0
        public WebElem(Browser b)
        {
            clickSetting = new ClickSetting()
            {
                PageTimeout = TimeSpan.FromSeconds(10), PollInterval = TimeSpan.FromMilliseconds(500)
            };
            typeSetting = new TypeSetting()
            {
                PageTimeout = TimeSpan.FromSeconds(10), PollInterval = TimeSpan.FromMilliseconds(500)
            };

            this.driv = b.driv;
            lines     = new List <LogItem>();
            lines.Add(new LogItem {
                LogLevel = loglevel.always, LogMessage = string.Format("Start Logging for test {0}", NUnit.Framework.TestContext.CurrentContext.Test.Name)
            });
            RunID = b.runID;

            foreach (var ll in b.logLevel.Split(','))
            {
                LogLevels.Add(ll.Trim().ToLower());
            }
        }
 public SezzleCheckoutAutomationHelper(ClickSetting defaultClickSetting, TypeSetting defaultTypeSetting)
 {
     _defaultClickSetting = defaultClickSetting;
     _defaultTypeSetting  = defaultTypeSetting;
 }
예제 #13
0
 public WebElem(IWebDriver Driv, ClickSetting defaultClickSettings)
 {
     clickSetting = defaultClickSettings;
     driv         = Driv;
 }
예제 #14
0
 public WebElem(IWebDriver Driv, ClickSetting defaultClickSettings, TypeSetting defaultTypeSetting)
 {
     clickSetting = defaultClickSettings;
     typeSetting  = defaultTypeSetting;
     driv         = Driv;
 }
예제 #15
0
        public void ClickAnchorInTable(by Table, string Find, int ColumNumber, string ButtonToClick, ClickSetting clickSetting, int NumberOfPagesToCheck = 10)
        {
            int startr = 2;

            try
            {
                Click(Table, ".//td[contains(.,'" + Find + "') and  position() = " + ColumNumber + "]/..//a[contains(.,'" + ButtonToClick + "')]", clickSetting);
            }
            catch
            {
                while (startr <= NumberOfPagesToCheck)
                {
                    try
                    {
                        Click(new by(By.XPath(".//a[contains(.,'" + Convert.ToString(startr) + "')]"), string.Format("The anchor representing the {0} page of the table {1}", Convert.ToString(startr), Table.Description)), clickSetting);

                        Click(Table, ".//td[contains(.,'" + Find + "') and  position() = " + ColumNumber + "]/..//a[contains(.,'" + ButtonToClick + "')]", clickSetting);
                        break;
                    }
                    catch { }
                    startr++;
                }
            }
        }
예제 #16
0
 public SeleniumHelper(ClickSetting defaultClickSetting, TypeSetting defaultTypeSetting)
 {
     countr       = 0;
     clickSetting = defaultClickSetting;
     typeSetting  = defaultTypeSetting;
 }