I am 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 am 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 am getting Null Pointer execption.

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

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

Thank you.

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. Apr 17 '19 at 10:12
  • 1
    Also you can paste your code here, so that we can easily check. Apr 17 '19 at 10:13
  • Thank you for your response. Adding a wait for the element to be visible worked.
    – Divya
    Apr 19 '19 at 1:19

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
    Apr 19 '19 at 1:17
  • please accept the answer if it solved your problem :) Apr 20 '19 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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