title: org.openqa.selenium.JavascriptException: javascript error: $ is not defined error taking coordinate screenshot with Ashot using ChromeDriver Selenium
body: <p>I have encountered a weird problem while working with <code>AShot</code>.
  <code>Ashot</code> works fine for whole screenShots but while selective screenShot it is <strong>BAD</strong>.
  It throws error in <strong>CoordsProvider</strong> Class while getting co-ordinates of element.
  am I using a faulty build or product?</p>
  
  <pre><code>public abstract class CoordsProvider implements Serializable {
  
  public abstract Coords ofElement(WebDriver driver, WebElement element);
  
  public Set&lt;Coords&gt; ofElements(WebDriver driver, Iterable&lt;WebElement&gt; elements) {
      Set&lt;Coords&gt; elementsCoords = new HashSet&lt;&gt;();
      for (WebElement element : elements) {
          ***Coords elementCoords = ofElement(driver, element);  //fails here***
          if (!elementCoords.isEmpty()) {
              elementsCoords.add(elementCoords);
          }
      }
      return Collections.unmodifiableSet(elementsCoords);
  }
  
  @SuppressWarnings("UnusedDeclaration")
  public Set&lt;Coords&gt; ofElements(WebDriver driver, WebElement... elements) {
      return ofElements(driver, Arrays.asList(elements));
  }
  
  @SuppressWarnings("UnusedDeclaration")
  public Set&lt;Coords&gt; locatedBy(WebDriver driver, By locator) {
      return ofElements(driver, driver.findElements(locator));
  }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/dQeCK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dQeCK.png" alt="enter image description here"></a>
  <strong>Stack trace</strong></p>
  
  <pre><code>org.openqa.selenium.JavascriptException: javascript error: $ is not defined
    (Session info: chrome=79.0.3945.130)
  Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:19:58.91Z'
  System info: host: 'OPTIMIZEQ-LTP03', ip: '192.168.99.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.2'
  Driver info: org.openqa.selenium.remote.RemoteWebDriver
  Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 79.0.3945.130, chrome: {chromedriverVersion: 78.0.3904.105 (60e2d8774a81..., userDataDir: C:\Users\SHAILE~1.SIN\AppDa...}, goog:chromeOptions: {debuggerAddress: localhost:61006}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(manual, http=localhos..., setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webdriver.remote.sessionid: f5a47b27537f019dacb73462732...}
  Session ID: f5a47b27537f019dacb734627324a790
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]
      at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:na]
      at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) ~[na:na]
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187) ~[selenium-remote-driver-3.14.0.jar:na]
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122) ~[selenium-remote-driver-3.14.0.jar:na]
      at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49) ~[selenium-remote-driver-3.14.0.jar:na]
      at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158) ~[selenium-remote-driver-3.14.0.jar:na]
      at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) ~[selenium-remote-driver-3.14.0.jar:na]
      at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:485) ~[selenium-remote-driver-3.14.0.jar:na]
      at ru.yandex.qatools.ashot.util.JsCoords.findCoordsWithJquery(JsCoords.java:30) ~[ashot-1.5.2.jar:na]
      at ru.yandex.qatools.ashot.coordinates.JqueryCoordsProvider.ofElement(JqueryCoordsProvider.java:13) ~[ashot-1.5.2.jar:na]
      at ru.yandex.qatools.ashot.coordinates.CoordsProvider.ofElements(CoordsProvider.java:21) ~[ashot-1.5.2.jar:na]
      at ru.yandex.qatools.ashot.AShot.takeScreenshot(AShot.java:115) ~[ashot-1.5.2.jar:na]
      at ru.yandex.qatools.ashot.AShot.takeScreenshot(AShot.java:132) ~[ashot-1.5.2.jar:na]
      at com.optq.main.util.SeleniumDriverUtility.captureAShotElement(SeleniumDriverUtility.java:563) ~[classes/:na]
  </code></pre>
  
  <p>Any help or Alternatives For Ashot are welcome,Please help me into this.</p>