PHP example:
<?php $xhe_host = "127.0.0.1:7013"; //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> webpage->".basename(__FILE__)."</font> <hr>"; //screenshot name $screen_name = "test \ kak.bmp"; if($browser->get_model() == "chromium") $screen_name = "test \ kak1.bmp"; //1 echo "1.Let's go to the site from which we have a screenshot:"; echo $browser->navigate("http://bigfozzy.com")."<br>"; //2 echo "2.Get the coordinates of the picture in the browser picture:"; $x = $webpage->get_x_in_webpage_picture($screen_name); $y = $webpage->get_y_in_webpage_picture($screen_name); echo "upper left corner of picture $x x $y <br>"; //3 echo "3.Move the mouse to the specified location:"; echo $mouse->move($x, $y)."<br>"; sleep(7); //4 echo "4.Let's go to the site from which we have a similar screenshot:"; echo $browser->navigate("http://vk.com")."<br>"; //five echo "5.Get the coordinates of the picture in the browser picture:"; $x = $webpage->get_x_in_webpage_picture($screen_name, 0.9,2); $y = $webpage->get_y_in_webpage_picture($screen_name, 0.9,2); echo "upper left corner of picture $x x $y <br>"; //6 echo "6.Move the mouse to the specified location:"; echo $mouse->move($x, $y)."<br>"; sleep(7); //7 echo "7.Get the coordinates of the picture in the browser picture:"; $x = $webpage->get_x_in_webpage_picture($screen_name, 0.7,3); $y = $webpage->get_y_in_webpage_picture($screen_name, 0.7,3); echo "upper left corner of picture $x x $y <br>"; //8 echo "8.Move the mouse to the specified location:"; echo $mouse->move($x, $y)."<br>"; //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:7013" from xweb_human_emulator import * # Start echo("<hr> <font color = blue> webpage.xxxxxxxxx </font> <hr>") # screenshot name screen_name = "test \ kak.bmp" if browser.get_model() == "chromium": screen_name = "test \ kak1.bmp" # 1 echo("1.Let's go to the site from which we have a screenshot:") echo(browser.navigate("http://bigfozzy.com"), "<br>") # 2 echo("2.Get the coordinates of the picture in the browser picture:") x = webpage.get_x_in_webpage_picture(screen_name) y = webpage.get_y_in_webpage_picture(screen_name) echo("upper left corner of picture" + str(x) + "x" + str(y) + "<br>") # 3 echo("3.Click on the given location:") echo(mouse.move(x, y), "<br>") # 4 echo("4.Let's go to the site from which we have a screenshot:") echo(browser.navigate("http://vk.com"), "<br>") # five echo("5.Get the coordinates of the picture in the browser picture:") x = webpage.get_x_in_webpage_picture(screen_name, 0.8,4) y = webpage.get_y_in_webpage_picture(screen_name, 0.8,4) echo("upper left corner of picture" + str(x) + "x" + str(y) + "<br>") # 6 echo("6.Click on the given location:") echo(mouse.move(x, y), "<br>") # 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; #endregion class Program: XHEScript { static void Main(string [] args) { //init XHE server = "127.0.0.1:7080"; InitXHE(); app.minimize_to_tray(); //Start echo("<hr> <font color = blue> webpage.get_x_in_webpage_picture </font> <hr>"); //screenshot name(link Briefly) string screen_name = "test \ kak.bmp"; if(browser.get_model() == "chromium") screen_name = "test \ kak1.bmp"; //1 step echo("1.Let's go to the site, from which we have a screenshot:"); echo(browser.navigate("http://bigfozzy.com/") + "<br>"); //step 2 echo("2.Get the coordinates of the picture in the browser picture:"); int x = webpage.get_x_in_webpage_picture(screen_name); int y = webpage.get_y_in_webpage_picture(screen_name); echo("upper left corner of the picture" + x + "x" + y + "<br>"); //step 3 echo("3.Let's go to the given location:"); echo(mouse.move(x, y) + "<br>"); sleep(2); //step 4 echo("4.Let's go to the site, from which we have a screenshot:"); echo(browser.navigate("vk.com") + "<br>"); //step 5 echo("5.Get the coordinates of the picture in the browser picture:"); x = webpage.get_x_in_webpage_picture(screen_name, 0.9,0); y = webpage.get_y_in_webpage_picture(screen_name, 0.9,0); echo("upper left corner of the picture" + x + "x" + y + "<br>"); //6 step echo("6.Let's go to the given location:"); echo(mouse.move(x, y) + "<br>"); //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:7013"; echo = require("../../../Templates JS/xweb_human_emulator.js"); //Start echo("<hr> <font color = blue> webpage.get_x_in_webpage_picture </font> <hr>"); //screenshot name screen_name = "test \ kak.bmp"; if(browser.get_model() == "chromium") screen_name = "test \ kak1.bmp"; //1 step echo("1.Let's go to the site, from which we have a screenshot:"); echo(browser.navigate("http://bigfozzy.com") + "<br>"); //step 2 echo("2.Get the coordinates of the picture in the browser picture:"); var x = webpage.get_x_in_webpage_picture(screen_name); var y = webpage.get_y_in_webpage_picture(screen_name); echo("upper left corner of the picture" + x + "x" + y + "<br>"); //step 3 echo("3.Click on the given location:"); echo(mouse.move(x, y) + "<br>"); app.sleep(2); //step 4 echo("4.Let's go to the site, from which we have a screenshot:"); echo(browser.navigate("http://vk.com") + "<br>"); //step 5 echo("5.Get the coordinates of the picture in the browser picture:"); var x = webpage.get_x_in_webpage_picture(screen_name, 0.7,3); var y = webpage.get_y_in_webpage_picture(screen_name, 0.7,3); echo("upper left corner of the picture" + x + "x" + y + "<br>"); //step 6 echo("6.Click on the given location:"); echo(mouse.move(x, y) + "<br>"); //end echo("<hr> <br>"); //Quit app.quit();