/// <summary> /// Method to launch and login to an app /// </summary> /// <returns>Operation result : true or false </returns> public bool LaunchAndLoginToApp() { try { SetDriverTimeOutForExceptionHandling(10000); // Navigate to app url Application.driver.Url = Constant.AppURL; try { // Login to app LoginToApp(); } catch { try { // handle continue window flow CommonUIOperation.EnterTextInTextBox(UserName, Constant.UserName, "Insert userName"); CommonUIOperation.ClickOnAnObject(Application.driver.FindElement(By.XPath("//input[@value='Continue']")), "Click on continue button"); LoginToApp(); } catch { //ignore this exception as Continue flow may be } } // check if home screen is showing up or not after login WaitForPageLoad(); if (HomeIcon.Displayed) { // Click on home icon CommonUIOperation.ClickOnAnObject(HomeIcon, "Click on Home icon"); } else { throw new Exception("Failed to perform launch and login app"); } return(true); } catch (Exception ex) { throw new Exception("Failed to perform Login operation" + Environment.NewLine + ex.Message); } finally { ResetDriverTimeOutToDefault(); } }
/// <summary> /// Method to open sheet from the display grid /// </summary> /// <param name="sheetName">provide sheet name</param> public void OpenSheetFromTable(string sheetName) { try { BrowserUtil.RefreshBrowser(Application.driver); //List<IWebElement> sheets = Application.driver.FindElements(By.XPath("//div[contains(@class, 'clsCellContent clsDetailItemOpenable clsImageRenderi')]")).ToList<IWebElement>(); IWebElement sheet = Sheets.Find(t => t.Text == sheetName); CommonUIOperation.ClickOnAnObject(sheet, "Click on sheet"); } catch (Exception ex) { throw new Exception(string.Format("Unable to find sheet with name: {0}", sheetName)); } }
public bool DeleteColumnFromSheetAndVerify(string columnName) { try { SetDriverTimeOutForExceptionHandling(10000); WaitForPageLoad(); // Find all the column form the displayed sheet var columnCountBeforeDeleteOps = ColumnNameElements.Count; // Filter the column by name which we want to delete IWebElement columnNameElement = ColumnNameElements.Find(t => t.Text.Contains(columnName)); // Right-Click on column and perform delete operation CommonUIOperation.RightClickOnAnObjectByMouse(Application.driver, columnNameElement, "Right Click on Column"); CommonUIOperation.ClickOnAnObject(DeleteOption, "Select Delete column option from the list"); // Verify column should be deleted var columnCountAfterDeleteOps = ColumnNameElements.Count; if (columnCountBeforeDeleteOps > columnCountAfterDeleteOps) { return(true); } else { return(false); } } catch (Exception ex) { return(false); } finally { ResetDriverTimeOutToDefault(); } }
/// <summary> /// Method to perform action on login page /// </summary> public void LoginToApp() { CommonUIOperation.EnterTextInTextBox(UserName, Constant.UserName, "Insert userName"); CommonUIOperation.EnterTextInTextBox(Pwd, Constant.Password, "Enter password"); CommonUIOperation.ClickOnAnObject(loginButton, "Click on login button"); }