vendredi 21 juillet 2017

In selenium for read image getting an error complie time "The import com.asprise.util cannot be resolved"

Here code is :- I want to read text from image but getting an error on recognizeCharacters that "The method recognizeCharacters(RenderedImage) is undefined for the type Ocr" it happens because not resolve to read import util:-

import com.asprise.util.ocr.OCR; (cannot be resolved)

@Test(description = "Click on Top Banner,Select first Product and Add in CART")
public void clickBannerAndAddProductInCart() throws Exception {

    Thread.sleep(500);
    // remove loginscreen
    page.click("xpath", "//*[@id='regis-form-test']/div[1]/span");
    // check presence of banner page
    page.explicityWaitPresence("xpath", "//*[@id='cro-test']/div[2]/div[2]/div/div/div[1]/div/div[1]/a/img");
    // click on Top banner page and check load page
    String imageUrl=d.findElement(By.xpath("//*[@id='cro-test']/div[2]/div[2]/div/div/div[1]/div/div[1]/a/img")).getAttribute("src");  
    System.out.println("Image source path : \n"+ imageUrl);  

    URL url = new URL(imageUrl);  
    Image image = ImageIO.read(url);  
    String s = new Ocr().**recognizeCharacters**((RenderedImage) image);  
    System.out.println("Text From Image : \n"+ s);  
    System.out.println("Length of total text : \n"+ s.length());
    Thread.sleep(500);
}

Aucun commentaire:

Enregistrer un commentaire