public static void ValidateUsersExist(DataTable UsersTable) { try { //Validate user details: foreach (DataRow UserRow in UsersTable.Rows) { //Search user by username before validation: Driver_Utilities.EnterText(SearchInput, UserRow["UserName"].ToString()); //Validate User: Driver_Utilities.ValidateElementExists(TableCellValue(UserRow["FirstName"].ToString())); Driver_Utilities.ValidateElementExists(TableCellValue(UserRow["LastName"].ToString())); Driver_Utilities.ValidateElementExists(TableCellValue(UserRow["UserName"].ToString())); Driver_Utilities.ValidateElementExists(TableCellValue(UserRow["Customer"].ToString())); Driver_Utilities.ValidateElementExists(TableCellValue(UserRow["Role"].ToString())); Driver_Utilities.ValidateElementExists(TableCellValue(UserRow["EMail"].ToString())); Driver_Utilities.ValidateElementExists(TableCellValue(UserRow["CellPhone"].ToString())); } Console.WriteLine("Validated all user(s) have been created."); } catch (Exception e) { Console.WriteLine("Failed to validate user(s) exist"); Console.WriteLine("[ERROR]:\n" + e.Message); throw e; } }
public static void NavigateToProtractorApp() { try { Driver_Utilities.NavigateToPage("http://www.way2automation.com/angularjs-protractor/webtables/"); Driver_Utilities.ValidateElementExists(UserTable); } catch (Exception e) { Console.WriteLine("[ERROR]:\n" + e.Message); throw e; } }
public static void ValidateSongLength(string SongTime) { try { OpenMusicPlayer(); Driver_Utilities.ValidateElementExists(By.XPath("//android.widget.TextView[@text=\"" + SongTime.Trim() + "\"]")); Console.WriteLine("Validated the currently playing song length is: " + SongTime); } catch (Exception e) { Console.WriteLine("[ERROR]:\n" + e.Message); throw e; } }