Beispiel #1
0
 public NavigationBlock(IWebDriver driver) : base(driver)
 {
     nextSlideButton     = UlearnDriver.FindElementSafely(Driver, ElementsId.NextNavArrow);
     prevSlideButton     = UlearnDriver.FindElementSafely(Driver, ElementsId.PrevNavArrow);
     nextSolutionsButton = UlearnDriver.FindElementSafely(Driver, ElementsId.NextSolutionsButton);
     CheckButtons();
 }
Beispiel #2
0
        private void Configure()
        {
            var unitsElements = UlearnDriver.FindElementsSafely(driver, By.XPath(XPaths.TocUnitsXPath)).ToList();

            CreateCollections();
            for (var i = 0; i < unitsElements.Count; i++)
            {
                var unitName = unitsElements[i].Text.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
                if (unitName == null)
                {
                    throw new Exception(string.Format("Юнит с номером {0} в курсе {1} не имеет названия", i, driver.Title));
                }
                if (unitName == "Total statistics" || unitName == "Users statistics" || unitName == "Personal statistics")
                {
                    if (!statistics.ContainsKey(unitName))
                    {
                        statistics.Add(unitName, new TocUnit(driver, i));
                    }
                }
                else
                {
                    if (units.ContainsKey(unitName))
                    {
                        continue;
                    }
                    var collapsedElement = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.UnitInfoXPath(i)));
                    var isCollapsed      = UlearnDriver.HasCss(collapsedElement, "collapse in");
                    initInfo.Add(unitName, new UnitInitInfo(unitsElements[i], i, isCollapsed));
                    units.Add(unitName, new Lazy <ITocUnit>(() => new TocUnit(driver, initInfo[unitName].Index)));
                }
            }
        }
Beispiel #3
0
 private new void Configure()
 {
     base.Configure();
     submitButton      = UlearnDriver.FindElementSafely(driver, ElementsClasses.QuizSubmitButton);
     submitAgainButton = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.QuizSubmitAgainButtonXPath));
     submitAgainStatus = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.QuizSubmitAgainStatusXPath));
     quizStatus        = GetQuizStatus();
 }
 private void Configure()
 {
     loginField           = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.RegistrationNameField));
     passwordField        = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.RegistrationPasswordField));
     confirmPasswordField = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.RegistrationConfirmPasswordField));
     registerButton       = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.RegistrationRegisterButton));
     CheckPage();
 }
Beispiel #5
0
 private bool IsHasAttempts(IWebElement webElement)
 {
     if (webElement == null)
     {
         return(false);
     }
     return(UlearnDriver.FindElementSafely(driver, By.Id("quiz-submit-btn")) != null ||
            UlearnDriver.FindElementSafely(driver, By.Id("SubmitQuiz")) != null);
 }
Beispiel #6
0
 public SlideListItem(IWebDriver driver, int slideIndex, int unitIndex)
 {
     this.slideIndex = slideIndex;
     this.unitIndex  = unitIndex;
     this.driver     = driver;
     slideElement    = new Lazy <IWebElement>(
         () => UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.TocSlideXPath(unitIndex, slideIndex))));
     slideLabelElement = new Lazy <IWebElement>(
         () => UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.TocSlideLabelXPath(unitIndex, slideIndex))));
 }
Beispiel #7
0
        private void Configure()
        {
            headerElement = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.TocUnitHeaderXPath(unitIndex)));
            var slidesCount = UlearnDriver.FindElementsSafely(driver, By.XPath(XPaths.TocSlidesXPath(unitIndex))).Count;             //UlearnDriver.courseManager.GetCourse(courseTitle).Slides.Count(x => x.Info.UnitName == unitName);

            slides = new List <Lazy <ITocSlide> >(slidesCount);
            for (var ind = 0; ind < slidesCount; ind++)
            {
                var lazyIndex = ind;
                slides.Add(new Lazy <ITocSlide>(() => new TocSlideControl(driver, lazyIndex, unitIndex)));
            }
        }
Beispiel #8
0
        private new void Configure()
        {
            base.Configure();
            var modal = UlearnDriver.FindElementSafely(driver, By.Id("selectGroupModal"));

            if (modal == null)
            {
                return;
            }
            Console.WriteLine("Close modal");
            IsUserFirstVisit  = false;           //пока сами закрываем окошко выбора группы
            groupSelector     = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.UserGroupSelectField));
            groupSelectButton = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.UserGroupSelectButton));
            groupSelector.SendKeys("0");
            groupSelectButton.Click();
        }
Beispiel #9
0
        public string GetSlideName()
        {
            var element = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.SlideHeaderXPath));

            return(element == null ? null : element.Text);
        }
Beispiel #10
0
 private void Configure()
 {
     name = new Lazy <string>(
         () => UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.TocSlideXPath(unitIndex, slideIndex))).Text);
     item = new Lazy <SlideListItem>(() => new SlideListItem(driver, slideIndex, unitIndex));
 }
Beispiel #11
0
        private bool IsCollapse()
        {
            var element = UlearnDriver.FindElementSafely(driver, By.XPath(XPaths.TocUnitHeaderCollapseInfoXPath(unitIndex)));

            return(UlearnDriver.HasCss(element, "in"));
        }