X-Scripts

READY-MADE SOLUTIONS FOR YOUR BUSINESS

OUR CONTACTS:
Skype: igor_sev2
Email : order@x-scripts.com

Script Human Emulator testing with emulation of user actions

Sometimes there are tasks connected with inspection and testing of certain the characteristics of a specific site by creating a maximum-humanoid, behavioral the chain of events on the website. For example, scrolling pages up and down to emulate reading information block of the site, mouse movements, clicks on random links on the page etc.

To resolve these problems, developers have created some of the functionality on the basis of Human Emulator. We are using this functionality wrote a script that emuleret user actions on the website. This script can be used to test the site.

Description of the script: on the site there is left menu, the task of the script is random click on the menu items and the slow scrolling of the next open page of the site first down any number of scroll, and then up and simulates the view content.

the script Itself:

<?php

/* manufacturer: x-scripts 
** product type: script Xweb Human Emulator 
** website: humanemulator.info 
** our site: x-scripts.com 
** all questions, please contact: 
** email: order@x-scripts.com 
** icq: 625657402 
** skype: igor_sev2 
*/

$xhe_host = "127.0.0.1:7000";

// The following code is required to properly run XWeb Human Emulator
require("../../Templates/xweb_human_emulator.php");

// //////////////////////// the script settings /////////////////////////
// target site
$my_site = "www.x-scripts.com/";
// pause wait
$wt = 5;
$wt_long = 10;
// depth pass inside the website
$depth_in_site = 1;

// //////////////////////// additional modules ///////////////
// function 
require_once("tools/functions.php");
// accept fucntions
require_once("tools/accept_functions.php");

// /////////////////////// script ///////////////////////////////////////////
echo "Script started<br>";

// go to the site
$browser->navigate($my_site);
sleep($wt);

// WALK THROUGH THE WEBSITE
// determine the depth of the passage inside the site
$depth_in_site = rand(1, 5);
echo "Depth of access into the site: $depth_in_site<br>";
for ($a = 0; $a < $depth_in_site; $a++)
{
echo "iteration $a<br>";
// slowly scrolling down the page, imitating reading
echo "scrolled down the page<br>";
scroll_down_page_slow(true);
sleep(rand(1,3));
// slowly scrolled the page up imitating reading
echo "scrolled the page up<br>";
scroll_up_page_slow(true);
sleep(rand(1,3));
// close the extra browser tabs
$browser->close_all_tabs();
sleep(2);
$browser->set_active_browser(0, true);
sleep(2);

// get a random number of internal links on the page
echo "Get a room accidentally link on the left menu click<br>";
$arr_of_names = array("Home", "Club", "School", "Scripts", 
"Articles", "Videos", "Proxy", "Useful", "Contacts", "Services", "Human Emulator");
$number = "";
$inner_text = "";
echo "going to click: ";
echo $inner_text = $arr_of_names[rand(0, count($arr_of_names)-1)];
echo "<br>";
$number = $anchor->get_number_by_inner_text($inner_text, true);
echo "Number of random links: $number<br>";
// skryim the screen to the point when the link appears in the scope, 
// move the mouse there and click
scroll_move_click($number);
sleep(rand($wt, $wt_long));
}

echo "Script finished the job.<br>";

// Quit
$app->quit();
?>



The script is written in 10.04.2014 Human Emulator 4.6.42.

download the script
Number of downloads: 3377

<< Other scripts