PHP example:
<?php $xhe_host = "127.0.0.1:7014"; //connect the object to control the emulator, if not already connected if(!isset($path)) $path = "../../../Templates/xweb_human_emulator.php"; require($path); //Start echo "<hr> <font color = blue> image->".basename(__FILE__)."</font> <hr>"; //1 echo "1.Let's go to the polygon:"; echo $browser->navigate("http://bigfozzy.com")."<br>"; sleep(1); //2 echo "2.Screenshot of web page to file:"; echo $webpage->print_screen("test \ test.bmp")." n"; sleep(1); //3 echo "3.Get the coordinates of the image(similarity coefficient 0.9):"; $pos = $image->get_pos_of_image("test \ test.bmp", "image \ kak.bmp", 0.9); print_r($pos); $mouse->move($pos->x, $pos->y, false); sleep(2); //4 echo " n4.Go to polygon:"; echo $browser->navigate("http://humanemulator.net/poligon/image.html")."<br>"; //five echo "5.Screenshot of the src image to file:"; echo $image->screenshot_by_src("test \ test.bmp", "http://www.humanemulator.net/screenshots/02.jpg")." n"; //6 echo "6.Cut the picture from the file:"; echo $image->get_image("test \ test.bmp", "test \ part.bmp", 126,72,40,33)." n"; //7 echo "7.Get the coordinates of the image(similarity coefficient 0.9):"; $pos = $image->get_pos_of_image("test \ test.bmp", "test \ part.bmp", 0.9); print_r($pos); $mouse->move($pos->x, $pos->y, false); sleep(2); //end echo "<hr> <br>"; //Quit $app->quit(); ?>
Python example:
# Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7070" from xweb_human_emulator import * # Start echo("<hr> <font color = blue> image.xxxxxxxxx </font> <hr>") # 1 echo("1.Let's go to the polygon:") echo(browser.navigate("http://bigfozzy.com"), "<br>") time.sleep(1) # 2 echo("2.Screenshot of web page to file:") echo(webpage.print_screen("test \ test.bmp"), " ") time.sleep(1) # 3 echo("3.Get the coordinates of the picture:") pos = image.get_pos_of_image("test \ test.bmp", "test \ kak1.bmp") echo(pos.x + "x" + pos.y, " ") # 4 echo("4.Move to polygon:") echo(browser.navigate("http://www.humanemulator.net/poligon/image.html"), "<br>") # five echo("5.Screenshot of the src image to file:") echo(image.screenshot_by_src("test \ test.bmp", "http://www.humanemulator.net/screenshots/02.jpg"), " ") # 6 echo("6.Cut the picture from the file:") echo(image.get_image("test \ test.bmp", "test \ part.bmp", 126,72,40,33), " ") # 7 echo("7.Get the coordinates of the picture:") pos = image.get_pos_of_image("test \ test.bmp", "test \ part.bmp") echo(pos.x + "x" + pos.y, " ") # end echo("<hr> <br>") # Quit app.quit()
C# example:
#region using using System; using System.Diagnostics; using System.Collections.Generic; using System.Linq; using System.IO; using System.Text; using System.Threading; using XHE; using XHE.XHE_DOM; using XHE.XHE_System; using XHE.XHE_Window; using XHE.XHE_Web; using System.Drawing; #endregion class Program: XHEScript { static void Main(string [] args) { //init XHE server = "127.0.0.1:7070"; InitXHE(); //Start echo("<hr> <font color = blue> image.get_x_of_image </font> <hr>"); //1 step echo("1.Let's go to the polygon:"); echo(browser.navigate("http://bigfozzy.com") + "<br>"); //step 2 echo("2.Screenshot of web page to file:"); echo(webpage.print_screen("test \ test.bmp") + " n"); //step 3 echo("3.Get the coordinates of the picture:"); Point pt = image.get_pos_of_image("test \ test.bmp", "image \ kak.bmp"); echo(pt.X + "x" + pt.Y + " n"); //step 4 echo("4.Let's go to the polygon:"); echo(browser.navigate("http://www.humanemulator.net/poligon/image.html") + "<br>"); //step 5 echo("5.Screenshot of the src image to file:"); echo(image.screenshot_by_src("test \ test.bmp", "http://www.humanemulator.net/screenshots/02.jpg") + " n"); //step 6 echo("6.Get the coordinates of the picture:"); pt = image.get_pos_of_image("test \ test.bmp", "image \ part.bmp"); echo(pt.X + "x" + pt.Y + " n"); //end echo("<hr> <br>"); app.quit(); } }
Java Script example:
//connect the object to control the emulator, if not already connected xhe_host = "127.0.0.1:7070"; echo = require("../../../Templates JS/xweb_human_emulator.js"); //Start echo("<hr> <font color = blue> image.get_x_of_image </font> <hr>"); //1 step echo("1.Let's go to the polygon:"); echo(browser.navigate("http://bigfozzy.com") + "<br>"); //step 2 echo("2.Screenshot of web page to file:"); echo(webpage.print_screen("test \ test.bmp") + " n"); //step 3 echo("3.Get the coordinates of the picture:"); var pos = image.get_pos_of_image("test \ test.bmp", "image \ kak.bmp"); echo(pos.x + "x" + pos.y + " n"); //step 4 echo("4.Let's go to the polygon:"); echo(browser.navigate("http://www.humanemulator.net/poligon/image.html") + "<br>"); //step 5 echo("5.Screenshot of the src image to file:"); echo(image.screenshot_by_src("test \ test.bmp", "http://www.humanemulator.net/screenshots/02.jpg") + " n"); //step 6 echo("6.Get the coordinates of the picture:"); pos = image.get_pos_of_image("test \ test.bmp", "image \ part.bmp"); echo(pos.x + "x" + pos.y + " n"); //end echo("<hr> <br>"); //Quit app.quit();