So I search and found some post regarding this but none of them worked for me. here is a layout of the html (changed for NDA reasons):
The Div is a wrapper, but it’s the one that contains all the links
the output i get is here:
2021-01-22 23:06:12.522 DEBUG testcase.test - 7: driver = getWebDriver()
2021-01-22 23:06:12.522 DEBUG testcase.test - 8: list = driver.findElements(By.xpath("//*[@id=‘notification-box’]/a"))
2021-01-22 23:06:12.630 DEBUG testcase.test - 9: out.println(list.size())
0
2021-01-22 23:06:12.639 INFO c.k.katalon.core.main.TestCaseExecutor - END Test Cases/CORE2_Welcome_Dash/test
Try it in the browser console, like I mentioned above. If it comes back zero, that’s length - which means you’re probably looking at the wrong container.
You showed me apbox, then changed it. I can’t help without seeing you actual HTML from the page.
You seem to be talking about these 2 IDs as if they are pointing to the same HTML element. But it can’t be the case. I guess that #apbox is right but #appointment-box is wrong (not present).
@kazurayam sorry for the. confusion ; >
I posted my actual ID i was using (appointment-box). So apbox was just made up. But now that you know #appointment-box is my real ID i am using.
When I do what @Russ_Thomas showed me in the browser I get return of 5 (see below screenshot)
But when i run it in the testcase it returns 0 using the following
When a human (YOU!) uses the browser console, there is a lot of time spent moving around and entering values in the console. That time allows the browser time to render the HTML on the page.
When Katalon runs your test case code, it runs SUPER FAST. There is very little time given to the browser to finish rendering the page.
In your test case code, WAIT until the the elements you need are VISIBLE:
@Russ_Thomas This is exactly what I thought it might be returning 0, so i entered a wait till page loads, and i even did a verify check if element exists for #appointment-box before running the JS portion.
Maybe I will wait for element visible for one of the appointments to load as well.