public void EditUserFunc(String searchtext, IWebElement UserEmailTextBox, String value, IWebElement dropdownelement, IWebElement ddlistbox, int ddloption, IWebElement FirstName, String fnamevalue, IWebElement LastName, String lnamevalue, IWebElement IsUserActiveFlag, IWebElement SaveUserBtn) { DriverUtils.LaunchBrowser("http://cos-test.psr.rd.hpicorp.net/COSWeb/ManageUser/UserManagement"); SearchTextBox.EnterText(searchtext); if (!string.IsNullOrEmpty(ManageUsersTableRow.Text) && (!string.IsNullOrWhiteSpace(ManageUsersTableRow.Text) && ManageUsersTableRow.Text.Contains(searchtext))) { Console.WriteLine("User data exist in the table" + ManageUsersTableRow.Text); EditUserBtn.Click(); UserEmailTextBox.EnterText(value); BasicMethods.DropDownFunction(dropdownelement, ddlistbox, ddloption); FirstName.EnterText(fnamevalue); LastName.EnterText(lnamevalue); IsUserActiveFlag.Click(); SaveUserBtn.Click(); Thread.Sleep(8000); //CreateUserCloseBtn.Click(); Common.ExtentReport.test.Log(AventStack.ExtentReports.Status.Pass, "Updated User Information!!"); } else { string s = BasicMethods.TakeScreenShot(); Common.ExtentReport.test.Log(AventStack.ExtentReports.Status.Fail, MarkupHelper.CreateLabel("No record found", ExtentColor.Red)).AddScreenCaptureFromPath(s); } }
public void SearchUser(IWebElement SearchTextBox, string searchuseremail) { //DriverUtils.LaunchBrowser("http://cos-test.psr.rd.hpicorp.net/COSWeb/ManageUser/UserManagement"); SearchTextBox.EnterText(searchuseremail); if (!string.IsNullOrEmpty(ManageUsersTableRow.Text) && (!string.IsNullOrWhiteSpace(ManageUsersTableRow.Text) && ManageUsersTableRow.Text.Contains(searchuseremail))) { Common.ExtentReport.test.Log(AventStack.ExtentReports.Status.Pass, "Given User\t" + searchuseremail + "\t record exist in the table"); Common.ExtentReport.test.Log(AventStack.ExtentReports.Status.Pass, "Given User Details is as follows" + "\t" + ManageUsersTableRow.Text); log.Info("Given User\t" + searchuseremail + "\t record exist in the table"); } else { Console.WriteLine(searchuseremail + "record not found in the table "); log.Info(searchuseremail + "\t" + "record not found in the table "); string s = BasicMethods.TakeScreenShot(); Common.ExtentReport.test.Log(AventStack.ExtentReports.Status.Fail, MarkupHelper.CreateLabel("Record not found", ExtentColor.Red)).AddScreenCaptureFromPath(s); } }
public static void Login(IWebElement usn, String usnvalue, IWebElement pwd, String pwdvalue, IWebElement btn, IWebElement expectedtext) { usn.EnterText(usnvalue); pwd.EnterText(pwdvalue); btn.Submit(); Thread.Sleep(3000); bool text = expectedtext.Displayed; if (text) { Console.WriteLine("Logged in successfully"); log.Info("Logged in successfully"); Common.ExtentReport.test.Log(AventStack.ExtentReports.Status.Pass, "Logged in successfully"); } else { Console.WriteLine("Login failed"); log.Info("Login failed"); string s = BasicMethods.TakeScreenShot(); Common.ExtentReport.test.Log(AventStack.ExtentReports.Status.Fail, MarkupHelper.CreateLabel("Login Failed", ExtentColor.Red)).AddScreenCaptureFromPath(s); } }