{"id":34736,"date":"2016-05-23T16:05:55","date_gmt":"2016-05-23T10:35:55","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=34736"},"modified":"2016-05-23T16:05:55","modified_gmt":"2016-05-23T10:35:55","slug":"integration-of-sikuli-with-selenium-webdriver","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/integration-of-sikuli-with-selenium-webdriver\/","title":{"rendered":"Integration of Sikuli with Selenium WebDriver"},"content":{"rendered":"<p align=\"justify\">Sikuli is an image-based open source tool to automate the GUI and can be used on any platform like Windows\/Linux\/Mac\/Mobile. Sikuli uses a technique called <b>image recognition <\/b>to identify and control GUI components. At times when to access a GUI object, there is no access to its internal or external code; Sikuli comes in handy. It simply automates anything you see on the screen.<\/p>\n<p align=\"justify\"><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-34738\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/05\/logo.png\" alt=\"logo\" width=\"133\" height=\"113\" \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0 \u00a0 \u00a0\u00a0<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-34739\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/05\/symbol_add.png\" alt=\"symbol_add\" width=\"103\" height=\"103\" \/>\u00a0 \u00a0\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-34737\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/05\/selelogo.png\" alt=\"selelogo\" width=\"123\" height=\"111\" \/><\/p>\n<p><span style=\"font-size: large\"><b>Need of Sikuli Integration with Selenium<\/b><\/span><\/p>\n<p align=\"justify\"><a name=\"more-4354\"><\/a>Although as easy as it is to use Sikuli, there is one overhead since there is no\u00a0built-in method to open a website\/web-application in Sikuli. So if you\u2019re executing a Sikuli\u00a0script, you need to make sure that the website is already open in a browser.<\/p>\n<p align=\"justify\">To overcome this, Sikuli can be paired with\u00a0<span style=\"color: #0000ff\"><span lang=\"zxx\"><a href=\"http:\/\/docs.seleniumhq.org\/projects\/webdriver\/\"><span style=\"color: #00000a\">Selenium WebDriver<\/span><\/a><\/span><\/span>. Selenium offers a method to open a website in a browser. Using that method will help us prevent the effort wasted every time to open the website manually in the browser. Once the application is open, we can easily run Sikuli scripts on that website.<\/p>\n<p align=\"justify\"><b>How it\u2019s done:<\/b><\/p>\n<p align=\"justify\">1. Crop the image of the object which could not be identified by Selenium and put it into data pool folder.<\/p>\n<p align=\"justify\">2. Pass the path of that image into selenium script.<\/p>\n<p align=\"justify\">3. At the run time, Sikuli searches the image on the screen and matches it to the image in the data pool. If found then it performs the desirable action on that object.<\/p>\n<p><span style=\"font-size: large\"><b>Sikuli Setup for Selenium<\/b><\/span><\/p>\n<ol>\n<li>In order to integrate Sikuli with Selenium, we need some jars such as<b> <\/b><span style=\"color: #000000\"><i>sikuli-script.jar, selenium-server-standalone-2.25.0.jar, selenium-java-2.25.0.jar\u00a0<\/i><\/span><i>(or you can download any version of jars)<\/i><\/li>\n<\/ol>\n<ol start=\"2\">\n<li><span style=\"color: #000000\">Create a java project in eclipse and add the listed external jars to your project using Build Path.<\/span><\/li>\n<\/ol>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-34740\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/05\/step1.png\" alt=\"step1\" width=\"220\" height=\"312\" \/><\/p>\n<p>3. Create a java class inside the project, say <i>Sikuli_Test.java.<\/i><\/p>\n<p>4. To work on images using Selenium, create an object of <b>Screen\/Pattern classes.<\/b><\/p>\n<p><span style=\"font-size: large\"><b>Sample Program<\/b><\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone  wp-image-34741\" src=\"\/blog\/wp-ttn-blog\/uploads\/2016\/05\/step2.png\" alt=\"step2\" width=\"508\" height=\"450\" \/><\/p>\n<p align=\"justify\"><a name=\"__DdeLink__453_1957737541\"><\/a> In the above program, we tried to open the homepage of \u2018google.com\u2019 followed by creating objects for the screen and pattern classes. In the pattern class, we have passed the reference of any image on which we have to perform any operation (like click\/double click\/type, etc.) While executing this program, Selenium searches the image on the screen which we have passed as reference and performs the desired action on that if it exists.<\/p>\n<p align=\"justify\">Nowadays Selenium is widely used tool for automating web-application. In real life, products are enterprise application, so we can expect application would be an integration of\u00a0Silverlight, Java Applets, Raphael Java Script, Canvas Objects, Java Scripts, JQuery, etc. However, we cannot expect everything gets identified with Selenium and can face challenges in automating the few of the above mentioned UI with Selenium. So this time you get stuck, add a flavor of Sikuli in your script.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sikuli is an image-based open source tool to automate the GUI and can be used on any platform like Windows\/Linux\/Mac\/Mobile. Sikuli uses a technique called image recognition to identify and control GUI components. At times when to access a GUI object, there is no access to its internal or external code; Sikuli comes in handy. [&hellip;]<\/p>\n","protected":false},"author":845,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":8},"categories":[1818,1],"tags":[3381,3380,3382,25,3379],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/34736"}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/845"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=34736"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/34736\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=34736"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=34736"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=34736"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}