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.
-
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.Upkar Singh– Upkar Singh2019年04月17日 10:12:07 +00:00Commented Apr 17, 2019 at 10:12
-
1Also you can paste your code here, so that we can easily check.Upkar Singh– Upkar Singh2019年04月17日 10:13:41 +00:00Commented Apr 17, 2019 at 10:13
-
Thank you for your response. Adding a wait for the element to be visible worked.Divya– Divya2019年04月19日 01:19:50 +00:00Commented 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– Divya2019年04月19日 01:17:46 +00:00Commented Apr 19, 2019 at 1:17
-
1please accept the answer if it solved your problem :)globalworming– globalworming2019年04月20日 18:30:31 +00:00Commented Apr 20, 2019 at 18:30
Explore related questions
See similar questions with these tags.