Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Error :javascript error: $ is not a function(While executing compare two images script using AShot())
Error :javascript error: $ is not a function [message #1831675] Wed, 26 August 2020 11:04 Go to next message
Saikiran Sikhakolli is currently offline Saikiran SikhakolliFriend
Messages: 1
Registered: August 2020
Junior Member
Hi,
I am trying to execute the code of compare two images by using AShot(). Please me a suggestion how to solve this problem.
I am using Eclipse IDE for Java Developers - 2019-12
Java 1.8 version,chrome version 84

please refer the attachment below Consle

import java.io.File;
import java.util.concurrent.TimeUnit;
import javax.imageio.ImageIO;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import ru.yandex.qatools.ashot.AShot;
import ru.yandex.qatools.ashot.Screenshot;

public class ImageScreenshot {

//WebDriver imported from : org.openqa.selenium.WebDriver;
static WebDriver driver;
public static void main(String[] args) throws Exception {

System.setProperty("webdriver.chrome.driver", "G:\\selenium\\Chrome Drivers\\chromedriver_win32 (1)\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().deleteAllCookies();
driver.manage().timeouts().pageLoadTimeout(30,TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
WebElement webElement = driver.findElement(By.id("site-logo"));
System.out.println("Image get from location");
Screenshot screenshot = new AShot().takeScreenshot(driver,webElement);
ImageIO.write(screenshot.getImage(), "PNG", new File(System.getProperty("G:\\Selenium-WorkSpace\\Everything\\images\\LogoImage.png")));

}

}
  • Attachment: Console.png
    (Size: 143.40KB, Downloaded 52 times)
Re: Error :javascript error: $ is not a function [message #1831703 is a reply to message #1831675] Thu, 27 August 2020 06:27 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
You're no doubt better off to ask on a forum dedicated to the framework you are using in this code sample. This forum is for asking questions about the Java Development Tools themselves and unless someone reading this forum actually knows something about this specific framework you are using, you're unlikely to get an answer here.

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Plugin could not be resolved (with config tag)
Next Topic:Tomcat server prints severe warning at start
Goto Forum:
  


Current Time: Fri Apr 26 18:17:47 GMT 2024

Powered by FUDForum. Page generated in 0.03069 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top