Exemple #1
0
        private void LogoutBtn_Click_(object sender, EventArgs e)
        {
            changeComponentVisabilty(m_ControlsToChangeVisibility);
            Control[] extraControls = new Control[] { panelFriendData, flowLayoutPanelPicturs };
            changeComponentVisabilty(extraControls);
            if (webBrowserGoogleFriend.Visible == true)
            {
                webBrowserGoogleFriend.Visible = false;
            }

            LoginBtn.Invoke(new Action(() => LoginBtn.Enabled = true));
            LoginBtn.Invoke(new Action(() => LoginBtn.Text    = "Login"));
            FacebookService.Logout(m_Observable.NotifyAll);
        }
Exemple #2
0
        private void bgw_DoWork(object sender, DoWorkEventArgs e)
        {
            e.Result = string.Empty;

            KeyValuePair <string, string> credentials = (KeyValuePair <string, string>)e.Argument;
            string username = credentials.Key;
            string password = credentials.Value;

            ErrorCodes error = ClientUtils.TryLogin(UserPlugin.Current, username, password, PluginBase.Current);

            if (error != ErrorCodes.OK)
            {
                LoginBtn.Invoke(new Action(() => e.Result = CheckResult(error)));
            }
        }
Exemple #3
0
 // Check username and password fields.
 private void PasswordTF_TextChanged(object sender, EventArgs e)
 {
     if (KeyChar == (char)13)
     {
         LoginBtn.PerformClick();
     }
     // Only enable login button when both fields have text in them.
     if (String.IsNullOrWhiteSpace(PasswordTF.Text))
     {
         LoginBtn.Enabled = false;
     }
     else
     {
         LoginBtn.Enabled = true;
     }
 }
Exemple #4
0
        protected override bool ProcessCmdKey(ref Message message, Keys keys)
        {
            switch (keys)
            {
            case Keys.Return:
                //Process action here.
                LoginBtn.PerformClick();
                break;

            case Keys.Escape:
                //Process action here.
                this.Close();
                break;
            }
            return(false);
        }
Exemple #5
0
        /// <summary>
        /// Clicks the user-specified element and then waits for a window to close or open, or a page to load,
        /// depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public void ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.LoginPage.LoginBtn))
            {
                if (buttonOrLinkElem.GetAttribute("id") == LoginBtn.GetAttribute("id"))
                {
                    LoginBtn.Click();
                    //new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("Default2"));
                    return;
                }
            }

            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
            }
        }
        public void LoginSteps()
        {
            Global.GlobalDefinitions.driver.Navigate().GoToUrl(ExcelLibHelp.ReadData(2, "Url"));

            //Click the sign-In tab
            SignIntab.Click();

            //sending values to email id
            Email.SendKeys(ExcelLibHelp.ReadData(2, "Username"));

            //sending velues of password
            Password.SendKeys(ExcelLibHelp.ReadData(2, "Password"));

            //Click login Button
            LoginBtn.Click();

            Global.GlobalDefinitions.wait(5);
        }
        private void LoginBtn_Click(object sender, EventArgs e)             //Login delen är nedan.
        {
            Encrypter.MD5Hash(PasswordLoginTxt.Text);
            Login.LoginChecker(EmailLoginTxt.Text, hashed);
            Login.LoginRoleChecker(EmailLoginTxt.Text);

            if (Log == "Successful")            //Om inloggningen går igenom så ska "nästa sida" visas. Då ska inloggninssidan gömmas.
            {
                if (role == "User")             //Om man har rollen "User" så ska man kunna se vissa saker.
                {
                    loginEmail = EmailLoginTxt.Text;
                    TabControl1.Show();
                    TabControl1.TabPages.Remove(tabPage2);
                    TabControl1.TabPages.Remove(tabPage3);
                    TabControl1.TabPages.Remove(TabPage4);
                    TabControl1.TabPages.Remove(tabPage6);
                    EmailLoginLbl.Hide();
                    PasswordLoginLbl.Hide();
                    LoginBtn.Hide();
                    EmailLoginTxt.Hide();
                    PasswordLoginTxt.Hide();
                    MailTxt.Hide();
                    MailBtn.Hide();
                    PWLbl.Hide();
                }
                else                         //Är man inte User så är man Admin och då ska man kunna se vissa saker.
                {
                    loginEmail = EmailLoginTxt.Text;
                    TabControl1.Show();
                    EmailLoginLbl.Hide();
                    PasswordLoginLbl.Hide();
                    LoginBtn.Hide();
                    EmailLoginTxt.Hide();
                    PasswordLoginTxt.Hide();
                    MailTxt.Hide();
                    MailBtn.Hide();
                    PWLbl.Hide();
                }
            }
            else                              //Annars så ska den skriva att det är fel lösenord eller email.
            {
                MessageBox.Show("Wrong Email or password!");
            }
        }
Exemple #8
0
        void ReleaseDesignerOutlets()
        {
            if (FacebookBtn != null)
            {
                FacebookBtn.Dispose();
                FacebookBtn = null;
            }

            if (GoogleBtn != null)
            {
                GoogleBtn.Dispose();
                GoogleBtn = null;
            }

            if (LoginBtn != null)
            {
                LoginBtn.Dispose();
                LoginBtn = null;
            }

            if (LoginDesc != null)
            {
                LoginDesc.Dispose();
                LoginDesc = null;
            }

            if (LoginPlaceholder != null)
            {
                LoginPlaceholder.Dispose();
                LoginPlaceholder = null;
            }

            if (LoginTitle != null)
            {
                LoginTitle.Dispose();
                LoginTitle = null;
            }

            if (MicrosoftBtn != null)
            {
                MicrosoftBtn.Dispose();
                MicrosoftBtn = null;
            }
        }
Exemple #9
0
        /// <summary>
        /// Clicks the user-specified element and then waits for a window to close or open, or a page to load,
        /// depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The button element</param>
        public HomePage ClickAndWait(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.LoginPage.LoginBtn))
            {
                if (buttonOrLinkElem.GetAttribute("id") == LoginBtn.GetAttribute("id"))
                {
                    LoginBtn.Click();
                    //new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("Default2"));
                    HomePage HP = new HomePage(Browser);
                    return(HP);
                }
            }

            else
            {
                throw new Exception("No button or link was found with your passed parameter");
            }
            return(null);
        }
Exemple #10
0
        /// <summary>
        /// Clicks the user-specified element and then waits for a window to close or open, or a page to load,
        /// depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public HomePage ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.LoginPage.LoginBtn))
            {
                if (buttonOrLinkElem.GetAttribute("id") == LoginBtn.GetAttribute("id"))
                {
                    LoginBtn.Click();
                    HomePage HP = new HomePage(Browser);
                    return(HP);
                }
            }

            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
            }

            return(null);
        }
        internal void LoginSteps()
        {
            //Populate the excel data
            GlobalDefinitions.ExcelLib.PopulateInCollection(Base.ExcelPathShareSkill, "SignIn");

            //Navigate to URL
            GlobalDefinitions.NavigateUrl();

            //Click on Sign In button
            SignIntab.Click();

            //Enter UserName
            Email.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Username"));

            //Enter Password
            Password.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Password"));

            //Click Login Button
            LoginBtn.Click();
        }
Exemple #12
0
        /// <summary>
        /// TDD implementaion through Excel.
        /// </summary>
        public string LoginToApplication(string[] data)
        {
            //var item = ExcelHelper.ReadDataFromKey("default");
            string email = string.Empty;

            //if (item.ToLower().Contains("default"))
            //{
            //email = UserName.EnterText(ExcelHelper.ReadData(2, "UserName"));
            //Password.EnterText(ExcelHelper.ReadData(2, "Password"));
            email = UserName.EnterText(data[0]);
            Password.EnterText(data[1]);
            LoginBtn.Click();
            Console.WriteLine("Login To Application Passed");
            //}
            //else
            //{
            //    Console.WriteLine("Login To Application failed. please seleect the default credential from Excel");
            //}

            return(email);
        }
Exemple #13
0
        /// <summary>
        /// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        /// depending on the button that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.LoginPage.LoginBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LoginBtn.GetAttribute("outerHTML"))
                {
                    LoginBtn.Click();
                    // Browser.WaitForElement(Bys.EducationCenterPage.MyCoursesTtl, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    //Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, TimeSpan.FromSeconds(60), ElementCriteria.IsEnabled);
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(90)).Until(ExpectedConditions.UrlContains("Courses.aspx"));

                    return(new EducationCenterPage(Browser));
                }
                else
                {
                    throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
                }
            }

            return(null);
        }
Exemple #14
0
 internal void SignInStep(IWebDriver driver)
 {
     // populate Excel
     //Populate the excel data
     GlobalDefinitions.ExcelLib.PopulateInCollection(MarsResources.ExcelPath, "SignIn");
     SignIntab.Click();
     Email.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Username"));
     password.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Password"));
     LoginBtn.Click();
     Thread.Sleep(2000);
     if (driver.WaitForElementDisplayed(By.XPath("//a[contains(text(),'Mars Logo')]"), 60))
     {
         test = extent.CreateTest("Login Test");
         SaveScreenShotClass.SaveScreenshot(driver, "Login");
         test.Log(Status.Pass, "Login Successful");
     }
     else
     {
         SaveScreenShotClass.SaveScreenshot(driver, "LoginFailed");
         test.Log(Status.Fail, "Login failed");
     }
 }
        internal void LoginSteps()
        {
            //extent Reports
            Base.test = Base.extent.StartTest("Login Test");

            //Populate the Excel sheet
            GlobalDefinitions.ExcelLib.PopulateInCollections(Global.Base.ExcelPath, "SignIn");

            //Navigate to the Url
            GlobalDefinitions.driver.Navigate().GoToUrl(GlobalDefinitions.ExcelLib.ReadData(2, "Url"));

            //Click on Sign In tab
            SignIntab.Click();
            GlobalDefinitions.wait(10);

            //Enter the data in Username textbox
            Email.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Username"));

            GlobalDefinitions.wait(10);

            //Enter the password
            Password.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Password"));

            //Click on Login button
            LoginBtn.Click();

            GlobalDefinitions.wait(20);

            string text = GlobalDefinitions.driver.FindElement(By.XPath("//*[@id='account-profile-section']/div/div[1]/a")).Text;

            if (text == "MarsLogo")
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Login Successful");
            }
            else
            {
                Global.Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Login Unsuccessful");
            }
        }
Exemple #16
0
        /// <summary>
        /// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        /// depending on the button that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public bool ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            bool buttonClicked = false;

            if (Browser.Exists(Bys.LoginPage.LoginBtn))
            {
                if (buttonOrLinkElem.GetAttribute("id") == LoginBtn.GetAttribute("id"))
                {
                    LoginBtn.Click();
                    //new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("Default2"));
                    buttonClicked = true;
                    return(buttonClicked);
                }
            }

            else
            {
                throw new Exception("No button or link was found with your passed parameter");
            }

            return(buttonClicked);
        }
Exemple #17
0
        public MyApplicationPageClass LoginInApplication(string username = null, string password = null)
        {
            LogoutFromApplication();
            if (username == null)
            {
                UserName.SendKeys(ObjectRepository.Config.GetUsername());
            }
            else
            {
                UserName.SendKeys(username);
            }

            if (password == null)
            {
                Password.SendKeys(ObjectRepository.Config.GetPassword());
            }
            else
            {
                Password.SendKeys(password);
            }

            LoginBtn.Click();
            return(new  MyApplicationPageClass(Driver));
        }
Exemple #18
0
        //Validate the password is changed
        internal void ValidateChangedPassword()
        {
            try
            {
                SignIn loginobj = new SignIn();
                loginobj.SignOutSteps();

                //Click on Sign In button
                SignIntab.Click();

                //Enter UserName
                Email.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Username"));

                //Enter the changed Password
                Password.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "New Password"));

                //Click Login Button
                LoginBtn.Click();
                Thread.Sleep(5000);

                GlobalDefinitions.ValidateBoolean(ChangePasswordDropDownLink.Displayed, "Password Changed");
            }
            catch (Exception e)
            {
                Base.test.Log(LogStatus.Fail, "Caught Exception For Change Password", e.Message);
            }

            //Resetting the password
            ChangePasswordDropDownLink.Click();
            Extension.WaitForElementDisplayed(GlobalDefinitions.Driver, By.XPath("//a[text()='Change Password']"), 5);
            ChangePasswordLink.Click();
            CurrentPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "New Password"));
            NewPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Password"));
            ConfirmPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Password"));
            SaveChangedPassword.Click();
        }
 public void LoginAs(String user, String passwd)
 {
     LoginUsername.SendKeys(user);
     LoginPassword.SendKeys(passwd);
     LoginBtn.Click();
 }
 public void Login(string email, string password)
 {
     EmailAddress.SendKeys(email);
     Password.SendKeys(password);
     LoginBtn.Click();
 }
Exemple #21
0
 private void frmLogin_Load(object sender, EventArgs e)
 {
     LoginBtn.Focus();
 }
        protected override void OnAppearing()
        {
            base.OnAppearing();

            LoginBtn.Focus();
        }
Exemple #23
0
        internal void LoginSteps()
        {
            //Start the Login
            Global.Base.test = Global.Base.extent.StartTest("Property Owner Login");
            //Populate in collection
            Global.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "LoginPage");
            //Navigate to Url
            Global.GlobalDefinition.driver.Navigate().GoToUrl(Global.ExcelLib.ReadData(2, "Url"));
            Global.GlobalDefinition.wait(500);
            //Enter Username
            Username.SendKeys(Global.ExcelLib.ReadData(2, "UserName"));
            //Enter Password
            Password.SendKeys(Global.ExcelLib.ReadData(2, "Password"));
            Thread.Sleep(500);
            //Checking login button is displayed with assert
            try
            {
                Assert.IsTrue(LoginBtn.Displayed);
            }
            catch (Exception e)
            {
                Console.Write(e);
            }
            //Click on login Button
            LoginBtn.Click();
            Thread.Sleep(1000);
            // Checking Page Title with assert
            try
            {
                string pageTitle = Global.GlobalDefinition.driver.Title;
                Assert.AreEqual("Properties | Property Community", "Properties | Property Community", pageTitle);
                //Assert.That(pageTitle,Does.Match("Dashboard"));
            }
            catch (Exception e)
            {
                Console.Write(e);
            }

            /*
             * //Verification
             * string message = Global.GlobalDefinition.driver.FindElement(By.XPath("//*[@id='main-content']/section/div[1]/h2")).Text;
             * string ActualMessage = Global.ExcelLib.ReadData(2, "LoginVerification");
             * //Explicit Wait
             * Thread.Sleep(2000);
             * if (message == ActualMessage)
             * {
             * Global.Base.test.Log(LogStatus.Pass, "Property Owner Login Successfull");
             * Global.SaveScreenShotClass.SaveScreenshot(Global.GlobalDefinition.driver, "Dashboard");
             * }
             * else
             * {
             * Global.Base.test.Log(LogStatus.Fail, "Property Owner Login Unsuccessfull");
             * }
             */


            Global.GlobalDefinition.driver.Manage().Window.Maximize();
            //Explicit Wait
            Thread.Sleep(1000);
            skipbtn.Click();
        }
 //radio leave focus login button
 private void Admin_Leave(object sender, EventArgs e)
 {
     LoginBtn.Focus();
 }
Exemple #25
0
 public void Login(string userName, string password)
 {
     txtUsrName.SendKeys(userName);
     txtPass.SendKeys(password);
     LoginBtn.Submit();
 }
Exemple #26
0
        //----------------------------------------------------------------------------

        //This is to click on Login button on header
        public void clickLoginBtn()
        {
            LoginBtn.Click();
        }
Exemple #27
0
 public void InitialFocus()
 {
     LoginBtn.Focus();
 }
Exemple #28
0
        private void LoginBtn_Click(object sender, EventArgs e)
        {
            String username     = usernameInput.Text;
            String password     = passwordInput.Text;
            String encryptedpwd = "";

            if (username == "")
            {
                MessageBox.Show("Username is required.", "Input Error");
                usernameInput.Focus();
            }
            else if (password == "")
            {
                MessageBox.Show("Password is required.", "Input Error");
                passwordInput.Focus();
            }
            else
            {
                byte[] hashBytes = Encoding.UTF8.GetBytes(password);
                using (MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider())
                {
                    hashBytes = md5.ComputeHash(hashBytes);
                    StringBuilder stringBuilder = new StringBuilder();
                    foreach (byte b in hashBytes)
                    {
                        stringBuilder.Append(b.ToString("X2"));
                    }
                    encryptedpwd = stringBuilder.ToString().ToLower();
                }

                String          connectionStr = "datasource=localhost;port=3306;username=root;password=;database=prototype;";
                MySqlConnection cnn           = new MySqlConnection(connectionStr);

                String       query   = "SELECT Username, Password, Status, Role FROM users WHERE Username = @username";
                MySqlCommand command = new MySqlCommand(query, cnn);
                command.Parameters.AddWithValue("@username", username);
                command.CommandTimeout = 60;
                MySqlDataReader reader;

                try
                {
                    cnn.Open();
                    reader = command.ExecuteReader();
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            String pwd = reader.GetString(1);

                            if (pwd != encryptedpwd)
                            {
                                MessageBox.Show("Password is incorrect", "Password not match");
                                passwordInput.Text = "";
                                passwordInput.Focus();
                            }
                            else
                            {
                                Boolean state = reader.GetBoolean(2);
                                if (!state)
                                {
                                    MessageBox.Show("This account is not disabled. Please contact the administrator.", "Account disabled");
                                    LoginBtn.Focus();
                                }
                                else
                                {
                                    String  role    = reader.GetString(3);
                                    Boolean isAdmin = false;
                                    if (role == "Admin")
                                    {
                                        isAdmin = true;
                                    }

                                    this.Hide();
                                    dashboardPage dashboard = new dashboardPage(username, isAdmin);
                                    dashboard.Show();
                                }
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("Username is unregistered.", "Username not exist");
                        usernameInput.Text = "";
                        usernameInput.Focus();
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message);
                }
            }
        }
Exemple #29
0
 public void ClickLoginButton()
 {
     LoginBtn.Click();
 }
Exemple #30
0
        public void FBLoginButtonSetting()
        {
            UIApplication.SharedApplication.BeginInvokeOnMainThread(() =>
            {
                #region loginButton Setting
                var facebookLoginButtonText = new NSAttributedString("以FB登入並繼續");

                LoginBtn.SetAttributedTitle(facebookLoginButtonText, UIControlState.Normal);
                LoginBtn.LoginBehavior   = LoginBehavior.Native;
                LoginBtn.ReadPermissions = Common.Variables.FBPermissions.ToArray();
                if (token != null)
                {
                    LoginBtn.SetAttributedTitle(new NSAttributedString("登出"), UIControlState.Normal);
                    ProfileName.Text = "Hi! " + currentProfile.Name + " 大美女";
                }

                #endregion

                // The user image profile is set automatically once is logged in
                pictureView = new ProfilePictureView(new CGRect(50, 50, 220, 220));

                // Create the label that will hold user's facebook name
                nameLabel = new UILabel(new RectangleF(20, 319, 280, 21))
                {
                    TextAlignment   = UITextAlignment.Center,
                    BackgroundColor = UIColor.Clear
                };
                loadingView.Hide();
            });


            // Handle actions once the user is logged in
            LoginBtn.Completed += (sender, e) =>
            {
                var SplitVC  = this.Storyboard.InstantiateViewController("SplitViewController");
                var listView = SplitVC.View;
                if (e.Error != null)
                {
                    // Handle if there was an error
                }

                if (e.Result.IsCancelled)
                {
                    // Handle if the user cancelled the login request
                }
                View.AddSubview(loadingView);
                // Handle your successful login
                token = AccessToken.CurrentAccessToken;
                if (token != null)
                {
                    LoginBtn.SetAttributedTitle(new NSAttributedString("登出"), UIControlState.Normal);
                    SplitVC.ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal;
                    this.PresentViewController(SplitVC, true, null);
                }
            };

            // Handle actions once the user is logged out
            LoginBtn.LoggedOut += (sender, e) =>
            {
                // Handle your logout
                token = AccessToken.CurrentAccessToken;
                if (token == null)
                {
                    LoginBtn.SetAttributedTitle(new NSAttributedString("以FB進行登入"), UIControlState.Normal);
                }
            };
        }