tag:blogger.com,1999:blog-543267854941927967.post5614451749129773593..comments2024-02-24T15:40:28.077+05:30Comments on My Thoughts: Extract and Verify the text from image using Selenium WebDriver Unknownnoreply@blogger.comBlogger32125tag:blogger.com,1999:blog-543267854941927967.post-65115433625783093492016-04-07T11:42:55.149+05:302016-04-07T11:42:55.149+05:30Hi All,
How can we select a date dynamically for ...Hi All,<br /><br />How can we select a date dynamically for the months which are not displayed in the view. Example, It's April and I want to select date from July which is not in the current datepicker view so how can we achieve that?Ankitnoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-4630780586412895292014-05-14T21:53:52.688+05:302014-05-14T21:53:52.688+05:30Please use this code wherever you found Two Jquery...Please use this code wherever you found Two Jquery calendar (Here i used Hash table)<br /><br /> Hashtable h=new Hashtable();<br /> h.put("January",0 );<br /> h.put("February",1);<br /> h.put("March",2);<br /> h.put("April",3);<br /> h.put("May",4);<br /> h.put("June",5);<br /> h.put("July",6);<br /> h.put("August",7);<br /> h.put("September",8);<br /> h.put("October",9);<br /> h.put("November",10);<br /> h.put("December",11);<br /> <br /> <br /> int expMonth;<br /> int expYear;<br /> <br /> // Calendar Month and Year<br /> String calMonth = null;<br /> String calYear = null;<br /> boolean dateNotFound;<br /> dateNotFound = true;<br /> expMonth= 5;<br /> expYear = 2014;<br /> <br /> while(dateNotFound)<br /> {<br /><br /> calMonth = driver.findElement(By.className("ui-datepicker-month")).getText(); // get the text of month<br /> calYear = driver.findElement(By.className("ui-datepicker-year")).getText();<br /> <br /> <br /> <br /> <br /> if(((Integer)h.get(calMonth))+1 == expMonth && (expYear == Integer.parseInt(calYear)))<br /> {<br /> String block="//div[@class='monthBlock first']/table/tbody/tr/td"; // THIS IS FIRST CALENDAR<br /> selectDate(expDate,block); <br /> dateNotFound = false; <br /> }<br /> // parseInt - Converts String to integer and indexof( It will return the index position of String)<br /> else if(((Integer)h.get(calMonth))+1 < expMonth && (expYear == Integer.parseInt(calYear)) || expYear > Integer.parseInt(calYear))<br /> {<br /> String block="//div[@class='monthBlock last']/table/tbody/tr/td"; // THIS IS SECOND CALENDAR<br /> <br /> selectDate(expDate,block); // PASSING DATE AND CALENDAR<br /> dateNotFound = false; // Otherwise it will rotate continuously <br /> }<br /> else if((Integer)h.get(calMonth)+1 > expMonth && (expYear == Integer.parseInt(calYear)) || expYear < Integer.parseInt(calYear))<br /> {<br /> System.out.println(" Please enter the date greater than Current date");<br /> dateNotFound = false;<br /> <br /> }<br /> }<br /><br /> }<br /> //Thread.sleep(3000);<br /><br /><br /> public static void selectDate(String date,String block) throws IOException<br /> {<br /> <br />String monthblock=block;<br /> <br /> List dateWidget = driver.findElements(By.xpath(monthblock)); <br /><br /> for (WebElement cell: dateWidget)<br /> {<br /> //Selects Date<br /> if (cell.getText().equals(date))<br /> {<br /> cell.findElement(By.linkText(date)).click();<br /> break;<br /> }<br /> <br /> }<br /> <br /> driver.findElement(By.id("SearchBtn")).submit();<br /><br /> driver.quit();<br /> }Venkatesh Pnoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-4488686568708906522014-02-03T19:08:02.022+05:302014-02-03T19:08:02.022+05:30Hey Akash,
Just want to know why do you want to se...Hey Akash,<br />Just want to know why do you want to select this text ? :) <br />Are you working any specific test case or you are exploring selenium in deep :) <br /><br /><br />If you are looking for copy paste you can do it using Keys method.Vamshi Kurrahttp://www.mythoughts.co.in/noreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-84364863669603801012014-02-03T19:03:16.859+05:302014-02-03T19:03:16.859+05:30OCR technology has its own limitations. It always ...OCR technology has its own limitations. It always won't give good results that we are looking for (bad I know :) )<br /><br />http://www.primafact.com/what-is-ocr-2/<br /><br />http://www.meridianoutpost.com/resources/articles/ocr-limitations.phpVamshi Kurrahttp://www.mythoughts.co.in/noreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-25706405760745729872014-02-03T18:55:14.330+05:302014-02-03T18:55:14.330+05:30HI,
Last time i was attached screenshot you don&#...HI,<br /><br />Last time i was attached screenshot you don't got screenshot?<br />Refer attached screenshot.Akash Guptanoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-28752035360031961562014-02-03T18:52:14.370+05:302014-02-03T18:52:14.370+05:30Hi..thanx for ur great post..
Is it possible to ex...Hi..thanx for ur great post..<br />Is it possible to extract the text from a Scanned JPG file which is stored in the system using Selenium..?<br /><br />If there is any possibility , can u please post the code for that?Ravinoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-70393099103398965102014-02-03T18:51:20.602+05:302014-02-03T18:51:20.602+05:30Is it possible to extract the text from a Scanned ...Is it possible to extract the text from a Scanned JPG file which is stored in the system using Selenium..?<br />If there is any possibility , can u please post the code for that?Ravinoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-64637310092825744692014-02-03T18:51:01.387+05:302014-02-03T18:51:01.387+05:30Can you add the screenshot once ?Can you add the screenshot once ?Vamshi Kurrahttp://www.mythoughts.co.in/noreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-5411459581845082402014-02-03T17:04:09.814+05:302014-02-03T17:04:09.814+05:30Hi,
Nice Blog, but i have one question.
Suppose i...Hi,<br /><br />Nice Blog, but i have one question.<br />Suppose i have one document then how can i select text from that document using selenium webdriver.<br />Refer attached screenshot for example of select text from document.<br />Please reply me ASAP.Akash Guptanoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-63444071653174969052014-01-29T12:36:44.982+05:302014-01-29T12:36:44.982+05:30Can you please try adding "AspriseOCR.dll&quo...Can you please try adding "AspriseOCR.dll" file at "C:\Windows\System32" and run ?Vamshi Kurrahttp://www.mythoughts.co.in/noreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-4365087976696596322014-01-28T23:38:17.498+05:302014-01-28T23:38:17.498+05:30Hi Guys i tried all the ways specified above , but...Hi Guys i tried all the ways specified above , but find the same error still , can any one help me out pls <br /><br /><br />I have donwloaded the ASpire OCR zipped file and unzipped<br />Copied the DLL files ( ASpireOCr.dll , DEVIL and iLU DLL to system32 folder)<br />Added the aspireOCr jar file to eclipse external jar<br />Now written a script to read the text inside The image <br /><br />I have added the Environment Path value as D:/Aspires - this folder consist of unzipped data <br />also have added the Environment classpath D:\ASpires\aspriseOCR.jar<br /><br />Now when i run the script<br /><br />WebDriver fire = new FirefoxDriver();<br />fire.get("http://www.mythoughts.co.in/2013/10/extract-and-verify-text-from-image.html");<br /> String urlOfImage=fire.findElement(By.xpath("//*[@id='post-body-5614451749129773593']/div[1]/div[1]/div/a/img")).getAttribute("src");<br /> <br /> System.out.println("image text"+urlOfImage);<br /><br /> URL url = new URL(urlOfImage);<br /> Image i0 = ImageIO.read(url);<br /> String s = new OCR().recognizeEverything((RenderedImage) i0); // exception got is here <br /> <br /> System.out.println(s); <br /><br /><br /><br /> Exception in thread "main" java.lang.UnsatisfiedLinkError: no AspriseOCR in java.library.path<br /><br /><br />Can any one please help me out in correcting it ?Kumarnoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-39335601191405659252014-01-08T14:03:47.584+05:302014-01-08T14:03:47.584+05:30Hi vamshi,
we can also use driver.findelement(By ...Hi vamshi,<br /><br />we can also use driver.findelement(By Locator).sendkeys(Keys.Return); <br /><br />to select the datesAmit Kapoornoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-70844754396536345242013-12-09T16:29:40.266+05:302013-12-09T16:29:40.266+05:30Thanks a lot, it really helped meThanks a lot, it really helped meNavneetnoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-59737817305752762732013-11-17T13:28:10.526+05:302013-11-17T13:28:10.526+05:30very helpful.....you can also do this with Onenote...very helpful.....you can also do this with Onenote,Read this - http://www.superpctricks.com/2013/11/how-to-extract-text-from-image-with.htmlAmarnoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-71074093478140595772013-11-10T15:01:41.925+05:302013-11-10T15:01:41.925+05:30Thank you so much Vamshi, got the resolution. Also...Thank you so much Vamshi, got the resolution. Also, we need to copy the following dll files[DevIL.dll, AspriseJTwain.dll, ILU.dll] as well into system32 location, otherwise we will get the below error:<br />*************<br />FAILED: start<br />java.lang.UnsatisfiedLinkError: C:\Windows\System32\AspriseOCR.dll: Can't find dependent libraries<br />at java.lang.ClassLoader$NativeLibrary.load(Native Method)<br />at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)...<br />*************Srikanth Nakkanoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-30446708337092975012013-11-05T12:19:35.611+05:302013-11-05T12:19:35.611+05:30Hi Anjala, Its my bad .
I forgot to add another s...Hi Anjala, Its my bad . <br />I forgot to add another step of adding "AspriseOCR.dll" file at "C:\Windows\System32" .<br /><br />Add a copy of AspriseOCR.dll file at C:\Windows\System32 and the errors will go off . :)Vamshi Kurrahttp://www.mythoughts.co.in/noreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-21225638172342310742013-11-05T12:16:02.146+05:302013-11-05T12:16:02.146+05:30Hi Srikanth , Its my bad . I forgot to add anothe...Hi Srikanth , Its my bad . I forgot to add another step of adding "AspriseOCR.dll" file at "C:\Windows\System32" . <br /><br />Add a copy of AspriseOCR.dll file at C:\Windows\System32 and the errors will go off . :)Vamshi Kurrahttp://www.mythoughts.co.in/noreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-78905944258674431802013-11-04T10:37:50.796+05:302013-11-04T10:37:50.796+05:30Hi, I just followed the same instructions in this ...Hi, I just followed the same instructions in this code but at the run time i get below error <br /><br />Exception in thread "main" java.lang.UnsatisfiedLinkError: no AspriseOCR in java.library.path<br /> at java.lang.ClassLoader.loadLibrary(Unknown Source)<br /> at java.lang.Runtime.loadLibrary0(Unknown Source)<br /> at java.lang.System.loadLibrary(Unknown Source)<br /> at com.asprise.util.ocr.OCR.loadLibrary(OCR.java:247)<br /> at com.asprise.util.ocr.OCR.(OCR.java:56)<br /> at Test2.main(Test2.java:29)Anjalanoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-21977935487320359392013-11-03T14:40:24.266+05:302013-11-03T14:40:24.266+05:30Hi vamshi.. I 2 got the same error. Pls tell me ho...Hi vamshi.. I 2 got the same error. Pls tell me how 2 resolve the above error..?Srikanth Nakkanoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-84122413950345326322013-11-02T05:42:54.946+05:302013-11-02T05:42:54.946+05:30I think the admin of this website is in fact worki...I think the admin of this website is in fact working hard in support of his website, as here every data is <br />quality based data.<br /><br />my blog post: <a href="http://wallinside.com/post-7396392-all-you-need-is-water-table-sugar-regular-salt-because-of-the-sodium-and-lite-salt-because-of-th.html" rel="nofollow">sports</a>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-65361000667530198142013-10-25T14:22:33.586+05:302013-10-25T14:22:33.586+05:30If PDF file file embedded within the webpage then ...If PDF file file embedded within the webpage then try to get the exact location of PDF file from sourcecode .Hope below one will help you.<br /><br />http://www.mythoughts.co.in/2012/05/webdriverselenium2-extract-text-from.htmlVamshi Kurrahttp://www.mythoughts.co.in/noreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-40008036362823226372013-10-25T14:03:01.240+05:302013-10-25T14:03:01.240+05:30Hi Vamshi,
I am using the browser and jars as you...Hi Vamshi,<br /><br />I am using the browser and jars as you said above. I tried using this code for my application. So, I made it generic instead of clicking on a particular day. It was not working but changed the code as below and it started working.<br /><br />if (cell.getText().equals(String.valueOf(day))){ // day is the input day we are providing<br /><br /> cell.findElement(By.linkText(cell.getText())).click();<br /><br /> break;<br /><br /> }<br /><br />I would also like to know if you will be able to help me with reading PDF that is embedded within the same web page, instead getting downloaded to a separate browser or window? For example, when you sign in to a web application, you will get redirected to a page, where you will find the agreement PDF displayed inside a frame which can be downloaded or read and agreed to proceed.<br /><br />Thanks,<br /><br />KannanKannannoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-67135389141706459742013-10-25T12:46:43.055+05:302013-10-25T12:46:43.055+05:30Hi Kannan,
I am on Firefox 24 and using selenium ...Hi Kannan,<br /><br />I am on Firefox 24 and using selenium 2.35 jars.Code is working for me without any issues . What version of firefox and jars you are using ?<br /><br />Did you modify the code in anyway like changing the website ?Vamshi Kurrahttp://www.mythoughts.co.in/noreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-33140592415533391612013-10-24T17:21:54.568+05:302013-10-24T17:21:54.568+05:30Hi Vamsi,
Datepicker is displayed, but not select...Hi Vamsi,<br /><br />Datepicker is displayed, but not selecting the date. It is entering the loop and I am able to print the date to the console.<br /><br />cell.findElement(By.linkText(String.valueOf(day))).click(); this particular code is not doing the required action.Kannannoreply@blogger.comtag:blogger.com,1999:blog-543267854941927967.post-55868112829860579422013-10-21T12:03:10.983+05:302013-10-21T12:03:10.983+05:30Pavan,
Can you try "2.37.0.0" version ...Pavan,<br /><br />Can you try "2.37.0.0" version of IEDriver. I tried "2.37.0.0" version of IEDriver and it is working fine for me . If you are still having an issue please send the url on which you are trying ?Vamshi Kurrahttp://www.mythoughts.co.in/noreply@blogger.com