public void Login() { try { //To create report directory and add HTML report into it string currentTime = DateTime.Now.ToString("hhmmssstt"); _extent = new ExtentReports(); var dir = AppDomain.CurrentDomain.BaseDirectory.Replace("\\bin\\Debug", "\\Test_Execution_Reports"); DirectoryInfo di = Directory.CreateDirectory(dir + "\\Test_Execution_Reports"); var htmlReporter = new ExtentHtmlReporter(dir + "\\Test_Execution_Reports\\DARS_" + currentTime + ".html"); htmlReporter.Config.Theme = AventStack.ExtentReports.Reporter.Configuration.Theme.Dark; _extent.AddSystemInfo("Application Name", "DARS"); _extent.AddSystemInfo("Environment", "QA"); _extent.AddSystemInfo("Machine", Environment.MachineName); _extent.AddSystemInfo("OS", Environment.OSVersion.VersionString); _extent.AddSystemInfo("Engineer Name", "Akash"); _extent.AttachReporter(htmlReporter); } catch (Exception e) { throw (e); } try { EncryptDecrypt encrypt = new EncryptDecrypt(); Info information = new Info(); ChromeOptions options = new ChromeOptions(); options.AddArguments("no-sandbox"); options.AddExcludedArgument("enable-automation"); options.AddUserProfilePreference("credentials_enable_service", false); options.AddUserProfilePreference("profile.password_manager_enabled", false); options.AddAdditionalCapability("useAutomationExtension", false); Drive.driver = new ChromeDriver(@information.chrome, options, TimeSpan.FromMinutes(3)); Drive.driver.Manage().Timeouts().PageLoad.Add(System.TimeSpan.FromSeconds(30)); //naviate to Url Drive.driver.Manage().Window.Maximize(); Drive.driver.Manage().Cookies.DeleteAllCookies(); Drive.driver.Navigate().GoToUrl(information.baseURL); Drive.driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); Console.WriteLine("Navigated to the 'demo Home Page' URL Sucessfully"); //Intitialize the page by calling it reference LoginPageObjects loginpage = new LoginPageObjects(); string UserName = encrypt.EncodingData(information.username); loginpage.EnterUserName(encrypt.DecodingData(UserName)); Console.WriteLine("UserName Entered"); string Password = encrypt.EncodingData(information.password); loginpage.EnterPassword(encrypt.DecodingData(Password)); Console.WriteLine("Password Entered"); Console.WriteLine("Stay Logged In"); loginpage.StaySignedIN(); Console.WriteLine("Logged In Sucessfully"); } catch (Exception e) { Console.WriteLine(e.Message); throw; } }
public void WhenThePasswordFieldIsDisplayedFillItWithPassword(string password) { Thread.Sleep(2000); loginPageObjects.EnterPassword(password); Console.WriteLine("Log: Password Field Filled"); }