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>"; $pp = new XHEPosition(1,1); //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.97):"; $pos = $image->get_all_pos_of_image("test \ test.bmp", "image \ kak.bmp", 0.97); print_r($pos); $mouse->move($pos [0]->x, $pos [0]->y, false); sleep(2); //4 echo " n4.Go 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")." 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"; sleep(2); //7 echo "7.Screenshot of the whole page:"; echo $webpage->print_screen("test \ test.bmp")." n"; //8 echo "8.Get the coordinates of the image(similarity coefficient 0.99):"; $pos = $image->get_all_pos_of_image("test \ test.bmp", "test \ part.bmp", 0.99); print_r($pos); $mouse->move($pos [0]->x, $pos [0]->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_all_pos_of_image("test \ test.bmp", "test \ kak1.bmp") echo(pos [0] .x + "x" + pos [0] .y) # 4 echo(" 4.Let's go to the 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.Cut the picture from the file:") echo(webpage.print_screen("test \ test.bmp"), " ") # 8 echo("8.Get the coordinates of the picture:") pos = image.get_all_pos_of_image("test \ test.bmp", "test \ part.bmp") echo(pos [0] .x + "x" + pos [0] .y + "" + pos [1] .x + "x" + pos [1] .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:"); List <Point> pts = image.get_all_pos_of_image("test \ test.bmp", "image \ kak.bmp"); echo(pts [0] .X + "x" + pts [0] .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 page to file:"); echo(webpage.print_screen("test \ test.bmp") + " n"); //step 6 echo("6.Get the coordinates of the picture:"); pts = image.get_all_pos_of_image("test \ test.bmp", "image \ part.bmp"); echo(pts [0] .X + "x" + pts [0] .Y + "" + pts [1] .X + "x" + pts [1] .Y); //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_all_pos_of_image("test \ test.bmp", "image \ kak.bmp"); console.log(pos); //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"); //6 echo("6.Screenshot of the whole page:"); echo(webpage.print_screen("test \ test.bmp") + " n"); //step 7 echo("7.Get the coordinates of the picture:"); pos = image.get_all_pos_of_image("test \ test.bmp", "image \ part.bmp"); console.log(pos); //end echo("<hr> <br>"); //Quit app.quit();