예제 #1
0
        /// <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="Browser">The driver instance</param>
        /// <param name="parentElem">The parent element that contains all of the menu items within the dropdown. </param>
        /// <param name="menuItemText">The exact text from the menu item after the button is clicked</param>
        public static void Grid_ClickMenuItemInsideDropdown(IWebDriver browser, IWebElement parentElem, string menuItemText)
        {
            IWebElement menuItemElem = ElemGet.Grid_GetMenuItemOnRowButton(browser, parentElem, menuItemText);

            // We need to use javascript based clicks because IE can not click dropdown menu items in some grids (For example, the Lifetime Support grids) using
            // the Selenium based clicks
            JavascriptUtils.Click(browser, menuItemElem);
        }
        /// <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();
        }