/// <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> /// If we ever need to implement a different kind of click, we can use this extension method. Right now, I have it setup to use javascript clicks /// for IE as an example, if we would ever need to do that. However, we set EnableNativeEvents to false in BaseInternetExplorerOptions, which /// accomplishes the same thing, so for now, this goes unused. /// </summary> /// <param name="self"></param> /// <param name="Browser"></param> public static void Click(this IWebElement self, IWebDriver Browser) { var element = self as IWebElement; // Note, using GetCapabilties is different from the way I coded the BrowserName property derived from the BrowserNames class. I hardcoded IE to have // a value of "internetexplorer" (no space) in that class. For the below GetCapabilities built-in selenium way of doing it, it ha a space between the // words internet and explorer if (Browser.GetCapabilities().BrowserName == "internet explorer") { JavascriptUtils.Click(Browser, element); } else { element.Click(); } }