开发者

Could I verify text in image using Selenium

I have an开发者_C百科 app very similar to Google/Yahoo map. I search for a location and it is displayed on map. When I see html of page, there are many segments and all of them are images. I wonder if there is any way to verify that text for searched location is available on page.

For example if I search

http://maps.yahoo.com/#mvt=m&lat=36.298746&lon=-115.139974&zoom=12&q1=las%20vegas

There would be "Las Vegas" displayed on page. Now how do I verify that "Las Vegas" is really displayed on page?


So you want to check that the text in the image with selenium. You will need to grab the url of the image, download that image, and put it through an OCR program.

So short answer, not with selenium


Sikuli allows verification of images, or parts of images. I've not tried it, or tried to integrate it with Selenium, but the concepts of what Sikuli can do, looks really good. Take a look at the project here: http://sikuli.org/


Actually I threat this here:

  1. Shows you how you can compare 2 images and get a differences image or a gif animation with the overlapping of the first 2:

http://testautomationexperiences.com/detect-layout-issues-using-file-hashes-and-imagemagick-for-compare/

  1. Do it in Selenium by using im4java and imagemagick; also the hash checking is the first step in verification:

http://testautomationexperiences.com/detect-layout-issues-using-file-hashes-and-imagemagick-for-compare-coding-in-java/

I hope it helps, even is not OCR.

For OCR, you need a library (created by you or an existing one) which you call from selenium.

Good luck, Claudiu Adam

http://testautomationexperiences.com/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜