J query script thrown exception while execute the script on iOS and Android platform

Hi,

While execute the J-Query script for hybrid application using Appium studio its thrown exception but locator value is validate and same script executable on Appium.

code: -
public List findElementsByJQuerySelector(String selector) {
List ret;
try {
WebDriverWait wait = new WebDriverWait(this.m_driver, this.m_findElementTimeout);
ret = (List)wait.until((driver) -> {
String script = “return $(’.cgtoolbartitle’).toArray()”;
RemoteWebDriver rd = (RemoteWebDriver)driver;
List result = (List)rd.executeScript(script, new Object[0]);
return result.size() == 0 ? null : result;
});
} catch (Exception var4) {
ret = null;
}

    return ret;
}