7 thoughts on “Selenium WebDriver script for login

  1. Why have you not used assertions.
    Also you can check for not equals check for the page title and call the tear down function itself. This will also remove the else statement and if the statement is not true then it will proceed further.
    This is good coding practice and will reduce the code

    1. Thank you for pointing it out. Actually i created an elementary test script. I would write about assertions in my upcoming tutorials and that is why i haven’t used it in this tutorial but i will surely take the teardown thing..

  2. if (!pageTitle.equals (“Sign in to Yahoo”))
    {
    system.out.println(“Launched the incorrect webpage”);
    Assert.fail();
    tearDown();
    }
    Similarly for invalid password check for not equal

Leave a Reply

Your email address will not be published. Required fields are marked *