I'm trying to click on an element, which is present in a block and the block itself becomes visible, when another element Your Trips is clicked on.

I'm able to find the element and click on Your Trips, but then, when I try to click on the Sign In button in the block I'm getting Null Pointer exception.

Name of the site: https://www.cleartrip.com/

I want to automate the sign in process using Page object Model.

enter image description here

  • you are getting Null Pointer Exception, just because may be in your class you would not able to call the driver instance correctly, i would suggest you to check your program logic correctly. Commented Apr 17, 2019 at 10:12
  • 1
    Also you can paste your code here, so that we can easily check. Commented Apr 17, 2019 at 10:13
  • Thank you for your response. Adding a wait for the element to be visible worked.
    – Divya
    Commented Apr 19, 2019 at 1:19

1 Answer 1


You most likely have to wait for the element to be visible. Have a look at https://stackoverflow.com/questions/20903231/how-to-wait-until-an-element-is-present-in-selenium

  • Thank you, adding the wait worked. public void clickOnToBeginLogin() { WebElement element = driver.findElement(SignIn); WebDriverWait wait = new WebDriverWait(driver,10); wait.until(ExpectedConditions.visibilityOf(element)); driver.findElement(SignIn).click(); }
    – Divya
    Commented Apr 19, 2019 at 1:17
  • 1
    please accept the answer if it solved your problem :) Commented Apr 20, 2019 at 18:30

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.