Getting an error on using findelements in my code

Am getting the below error for this line of my code WebUI.findElements(By.Id(“my element id goes here”)).length() !=0 . Please help!!

FAILED because (of) groovy.lang.MissingMethodException: No signature of method: static org.openqa.selenium.By.Id() is applicable for argument types: (java.lang.String) values: [my element id goes here]
Possible solutions: id(java.lang.String), is(java.lang.Object), find(), any(), find(groovy.lang.Closure), wait()


Thank you so much. It worked.

Hi there,

You need to get the current web driver session and then use that instead. The correct script in your cases should be:

import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement

WebDriver driver = DriverFactory.getWebDriver()