3

I am using Katalon to build the base Selenium script of which will allow me to have an automated login for gmail. I do however need to add password and username verification in between my test method code. I just need help understanding and if possible, a base template, for how I should structure my verification code. As my title says, I just need help understanding how to code login verification. Thanks ahead of time. Here is my [Test Method]. I am removing my username and password for security reasons, however my username is in the structure of [email protected] and my password follows this structure asd2098KAM.

[TestMethod]
    public void TheUntitledTestCaseTest()
    {
        driver.Navigate().GoToUrl("https://www.google.com/");
        driver.FindElement(By.LinkText("Gmail")).Click();
        driver.FindElement(By.LinkText("Sign In")).Click();
        driver.FindElement(By.Id("identifierId")).Clear();
        driver.FindElement(By.Id("identifierId")).SendKeys("aaaa.ksat97");
        driver.FindElement(By.Id("identifierId")).SendKeys(Keys.Enter);
        driver.FindElement(By.Name("password")).Clear();
        driver.FindElement(By.Name("password")).SendKeys("aln9178JKM");
        driver.FindElement(By.Name("password")).SendKeys(Keys.Enter);
    }

1 Answer 1

1
  1. You can assert if your username displays. A displayed username would indicate a successful login.

  2. You can also see if a token/cookie is added to your session on login.

  3. Or see what response gmail sends back on failure/successful login post. Depending on the response you can assert if it's a successful login or not.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.