I would like to count, how many times are the same element present on page. I am looking for similar method than Verify Elements Count for webservices.
Try something like this, to print number of elements with “your-class” class. Change locators according to your need.
WebDriver driver = DriverFactory.getWebDriver() def eleCount = driver.findElements(By.className("your-class")).size() println eleCount
I imported com.kms.katalon.core.webui.driver.DriverFactory, but got error message:
71.groovy: 46: unable to resolve class WebDriver
You’ll need this
Btw, you can pres ctrl+shift+o to import missing libraries.