Ejemplo n.º 1
0
 public ProfilePage GoToProfile()
 {
     ClickOnProfileDropdown();
     btnProfile = driver.GetByXpath("//a[@href='/profile']");
     btnProfile.Click();
     return(GetPOM <ProfilePage>(driver));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Handle the clicking of a checkbox.
        /// If the current web element is not enabled and desiredState is true, click.
        /// If the current web element is enabled and desired state is false, click.
        /// Otherwise the checkbox is already in the desired state.
        /// </summary>
        /// <param name="e">WebElementWrapper</param>
        /// <param name="desiredState">True to have the checkbox enabled, false for not</param>
        private void handleCheckbox(WebElementWrapper e, bool desiredState)
        {
            bool isEnabled = e.Enabled;

            if ((isEnabled && !desiredState) || (!isEnabled && desiredState))
            {
                e.Click();
            }
        }
        /// <summary>
        /// SelectCourseName method to check/uncheck checkbox
        /// Parameters:
        /// WebElementWrapper checkBox
        /// bool status = true  - check the checkbox
        /// bool status = false - uncheck the checkbox
        /// </summary>
        /// <param name="checkBox"></param>
        /// <param name="status"></param>
        public void CheckBoxClick(WebElementWrapper checkBox, bool status)
        {
            switch (status)
            {
            case true:
                if (!checkBox.Selected)
                {
                    checkBox.Click();
                }
                break;

            case false:
                if (checkBox.Selected)
                {
                    checkBox.Click();
                }
                break;
            }
        }
Ejemplo n.º 4
0
        private void SetUniqueControlIdentifiers()
        {
            AnswerChoiceTabs = new Dictionary <string, ItemTypeTabForm>();
            InteractionTabs.WaitUntilVisible();
            //get the tabs
            ReadOnlyCollection <IWebElement> webElementTabs = Driver.FindElements(ByInteractionTabs);

            Report.Write("Found the elements by: '" + ByInteractionTabs.ToString() + "'.");
            if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
            {
                DummyWebElement dummy1 = new DummyWebElement();
                dummy1.FakeAttributeId    = "tabfc5d6a01-9539-46d2-966a-15ab568698e8";
                dummy1.FakeAttributeClass = "active";
                DummyWebElement dummy2 = new DummyWebElement();
                dummy2.FakeAttributeId    = "tabe2e3dda0-5708-40b5-8354-198a1232176a";
                dummy2.FakeAttributeClass = "";
                DummyWebElement dummy3 = new DummyWebElement();
                dummy3.FakeAttributeId    = "tab76962807-988c-4d06-b977-9f9a4c35d87f";
                dummy3.FakeAttributeClass = "";
                List <IWebElement> list = new List <IWebElement> {
                    dummy1, dummy2, dummy3
                };
                webElementTabs = new ReadOnlyCollection <IWebElement>(list);
            }

            int dummyindex = 1;
            int index      = 0;

            foreach (var webElement in webElementTabs)
            {
                string tempTabId = webElement.GetAttribute("id");
                Report.Write("Got the attribute: 'id' = '" + tempTabId + "' of this element by: '" + ByInteractionTabs.ToString() + "'.");

                //parse the tab ids to get the root id
                int    from  = tempTabId.IndexOf("tab") + "tab".Length;
                string tabId = tempTabId.Substring(from);

                string tabClass = webElement.GetAttribute("class");
                Report.Write("Got the attribute: 'class' = '" + tabClass + "' of this element by: '" + ByInteractionTabs.ToString() + "'.");
                InteractionTab = new WebElementWrapper(By.CssSelector("#tab" + tabId + " > a"));
                InteractionTab.Wait(3).Text = "" + dummyindex;
                dummyindex++;
                string tabName = InteractionTab.Text.Trim();
                //string tabName, string tabId, string tabClass
                Report.Write("Tab control identifier by tabName: " + tabName + "; tabId: " + tabId + "; tabClass: " + tabClass);
                //click the tab to make it visible, then create the item type tab object
                InteractionTab.Click();
                //create an item type tab object
                var itemTypeFormTab = new ItemTypeTabForm(ItemType.InlineResponse, tabName, tabId, tabClass,
                                                          index, ControlPrefix);
                //add the item type tab object to the collection (1, 2, 3)
                AnswerChoiceTabs.Add(tabName, itemTypeFormTab);
                index = index + 1000;
            }
        }
Ejemplo n.º 5
0
 public void LogOut()
 {
     ClickOnProfileDropdown();
     btnLogOut = driver.GetByXpath("//a[@href='/logout']");
     btnLogOut.Click();
 }
Ejemplo n.º 6
0
 public void ClickOnProfileDropdown()
 {
     dropdownProfile = driver.GetByXpath("//a[@class='user-profile dropdown-toggle']");
     dropdownProfile.Click();
 }
Ejemplo n.º 7
0
 public virtual void Click()
 {
     element.Click();
 }
Ejemplo n.º 8
0
        /// <summary>
        /// focus on main content area, to stop hover over menu
        /// </summary>
        public void FocusOnMainContentArea()
        {
            try
            {
                Point dummyPoint = new Point(0, 0);
                Point point;

                GlobalAppHeader = new WebElementWrapper(ByGlobalAppHeader);
                GlobalNav       = new WebElementWrapper(ByGlobalNav);
                MainContentArea = new WebElementWrapper(ByMainContentArea);
                AppTitle        = new WebElementWrapper(ByAppTitle);

                //new DriverCommands(Driver).GetScreenshotAndPageSource();
                //move to the header
                GlobalAppHeader.Wait(3);
                GlobalAppHeader.LocationOnScreenOnceScrolledIntoView = dummyPoint;
                point = GlobalAppHeader.LocationOnScreenOnceScrolledIntoView;
                GlobalAppHeader.Location = dummyPoint;
                point = GlobalAppHeader.Location;
                if (this.TestConfiguration.BrowserName != BrowserType.SAFARI)
                {
                    GlobalAppHeader.MoveToElement();
                }

                //new DriverCommands(Driver).GetScreenshotAndPageSource();
                //move to the global nav
                GlobalNav.Wait(3);
                GlobalNav.LocationOnScreenOnceScrolledIntoView = dummyPoint;
                point = GlobalNav.LocationOnScreenOnceScrolledIntoView;
                GlobalNav.Location = dummyPoint;
                point = GlobalNav.Location;
                if (this.TestConfiguration.BrowserName != BrowserType.SAFARI)
                {
                    GlobalNav.MoveToElement();
                }

                //new DriverCommands(Driver).GetScreenshotAndPageSource();
                //move to the main content area
                MainContentArea.Wait(3);
                MainContentArea.LocationOnScreenOnceScrolledIntoView = dummyPoint;
                point = MainContentArea.LocationOnScreenOnceScrolledIntoView;
                MainContentArea.Location = dummyPoint;
                point = MainContentArea.Location;
                if (this.TestConfiguration.BrowserName != BrowserType.SAFARI)
                {
                    MainContentArea.MoveToElement();
                }

                try
                {
                    AppTitle.Wait(3);
                    if (this.TestConfiguration.BrowserName != BrowserType.SAFARI)
                    {
                        AppTitle.MoveToElement();
                    }
                    AppTitle.Click();
                }
                catch (Exception ex)
                {
                    //new DriverCommands(Driver).GetScreenshotAndPageSource();
                    //click on main content area
                    MainContentArea.Click();
                }
            }
            catch (Exception e)
            {
                throw new Exception("\nInnerException:\n" + e.InnerException + "\nStackTrace:\n" + e.StackTrace, e);
            }
        }
Ejemplo n.º 9
0
 public void ClickOnDropdown()
 {
     btnLanguage = driver.GetByXpath("//*[@id='language-dropdown']");
     btnLanguage.Click();
 }