/// <summary>
        /// This will click on any button within a row on a table and then click the menu item that appears from that button
        /// </summary>
        /// <param name="tblElem">You table element that is found within the your Page class. i.e. OP.PendingAcceptanceTbl</param>
        /// <param name="rowElemBy">Your row element as it exists in your By type. i.e. Bys.CBDObserverPage,PendingAcceptanceTblRowBody"/></param>
        /// <param name="firstColumnCellText">The name of the row. i.e. The exact text from cell inside the first column</param>
        /// <param name="additionalCellText">Send "null" to this parameter if your table does not allow duplicate rows for the first column. If the first column in your row does not have to be unique compared to other rows in your table, and you would want to specify an additional column value to find your row, you can do that here. Send the exact text of any other column.</param>
        /// <param name="btnText">The exact text from the button to click, which when clicked on, results in a menu appearing</param>
        /// <param name="menuItemText">The exact text from the menu item after the button is clicked</param>
        public static void Grid_ClickMenuItemInsideButton(IWebDriver browser, IWebElement tblElem, By rowElemBy, string firstColumnCellText, string additionalCellText, string btnText, string menuItemText)
        {
            IWebElement btn = Grid_ClickButtonOrLinkWithinRow(browser, tblElem, rowElemBy, firstColumnCellText, additionalCellText, btnText);

            Thread.Sleep(0300);

            IWebElement btnParent = XpathUtils.GetNthParentElem(btn, 3);

            IWebElement menuItemElem = ElemGet.Grid_GetMenuItemOnRowButton(browser, btnParent, menuItemText);

            menuItemElem.Click();
        }
Esempio n. 2
0
        /// <summary>
        /// Clicks a radio button of your choice
        /// </summary>
        /// <param name="browser">The driver instance</param>
        /// <param name="textOfRadioBtn">The exact text as it appears in the HTML of the radio button to click</param>
        /// <returns></returns>
        public static string RdoBtn_ClickByText(IWebDriver browser, string textOfRadioBtn)
        {
            // Right now I have to implement the below IF statement for radio buttons, as their tags are different
            // between learners and observers. Nirav is going to fix this. Once he does, I can implement the simpler solution
            string xpathString = string.Format("//label/span[text()='{0}']", textOfRadioBtn);

            //Thread.Sleep(3000);

            if (browser.FindElements(By.XPath(xpathString)).Count > 0)
            {
                IWebElement rdoBtn       = ElemGet.RdoBtn_GetRdoBtn(browser, textOfRadioBtn);
                IWebElement rdoBtnParent = XpathUtils.GetNthParentElem(rdoBtn, 1);
                rdoBtnParent.Click();
                return(textOfRadioBtn);
            }
            else
            {
                IWebElement rdoBtn = ElemGet.RdoBtn_GetRdoBtn(browser, textOfRadioBtn);
                rdoBtn.Click();
                return(textOfRadioBtn);
            }
        }