humanemulator.net — справка.
Продукт, демо и покупка — на
хуманэмулятор.рф
|
Демо
|
Купить
|
API
|
лог изменений
send_touch
send_touch($id,$touch_type,$dx,$dy,$radiusX=0,$radiusY=0,$rotationAngle=0,$pressure=0,$modiefiers=0,$pointerType=0); - эмулировать нажатие (взаимодействие) пальцами по элементу на уровне событий относительно левого верхнего угла элемента ( доступна с 7.0.37 )Функция на вход принимает параметры:
После отработки функция возвращает результат своей работы в скрипт :
Пример использования
<?php // Scenario: Send touch event to a DOM element // Description: For current page, find an DOM element and send touch events to it // Classes used: XHEH, XHEInterface, XHEBrowser, XHEApplication // Connection string to XHE API $xhe_host = "localhost:7010"; // Path to init.php file if (!isset($path)) { // Path to init.php file for connecting to XHE API $path = "../../../Templates/init.php"; // When connecting init.php file, all functionality of classes for working with XHE API will be available require($path); } // Navigate to the polygon page if the page was not loaded earlier echo WEB::$browser->navigate(TEST_POLYGON_URL . "anchor.html") . "\n"; // Example: Send touch event to an DOM element // Note: To use touch emulation, make sure that the "Touch event support" option is enabled in the settings. // Get DOM element header by number 0 $targetHeader = DOM::$h3->get_by_number(0); // Check that DOM element was found if ($targetHeader->inner_number != -1) { // Perform a series of taps on a DOM element to select a single word of text echo("Perform a series of taps on a DOM element to select a single word of text: "); echo("\nPress touch: "); var_export($targetHeader->send_touch(0, 1, -1, -1, 30, 30)); // id=0, touch_type=1, dx=-1, dy=-1, radiusX=30, radiusY=30 echo("\nRelease touch: "); var_export($targetHeader->send_touch(0, 0, -1, -1, 30, 30)); // id=0, touch_type=0, dx=-1, dy=-1, radiusX=30, radiusY=30 echo("\nPress touch: "); var_export($targetHeader->send_touch(0, 1, -1, -1, 30, 30)); // id=0, touch_type=1, dx=-1, dy=-1, radiusX=30, radiusY=30 // Perform a series of taps by coordinates on a DOM element to select a single word of text // Get DOM element coordinates $x = $targetHeader->get_x(); $y = $targetHeader->get_y(); echo("\DOM element coordinates: ($x:$y)"); echo("Perform a series of taps by coordinates on a DOM element to select a single word of text: "); echo("\nPress touch: "); var_export($targetHeader->send_touch(0, 1, $x, $y, 30, 30)); // id=0, touch_type=1, dx=-1, dy=-1, radiusX=30, radiusY=30 echo("\nRelease touch: "); var_export($targetHeader->send_touch(0, 0, $x, $y, 30, 30)); // id=0, touch_type=0, dx=-1, dy=-1, radiusX=30, radiusY=30 echo("\nPress touch: "); var_export($targetHeader->send_touch(0, 1, $x, $y, 30, 30)); // id=0, touch_type=1, dx=-1, dy=-1, radiusX=30, radiusY=30 // Copy selected text to the OS clipboard `Ctrl+C` //echo("Copy selected text to the OS clipboard: "); //var_export(SYSTEM::$keyboard->send_key("c", true, true)); // Get text from the clipboard //echo("Get text from the clipboard: "); //var_export(SYSTEM::$clipboard->get_text()); } // Stop application WINDOW::$app->quit(); ?>
# Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7084" from xweb_human_emulator import * # начало echo("<hr><font color=blue>interface.xxxxxxxxx</font><hr>") # 1 echo("1. Перейдем в гугл : "); echo(browser.navigate("http://www.google.ru"),"<br>"); # 2 echo("2. Переместим мышь на About' : "); obj = anchor.get_by_inner_text("About"); echo(obj.mouse_move(10,10)," "); sleep(4); echo(obj.send_touch(0,1,10,10)," "); echo(obj.send_touch(0,0,10,10),"<br>"); # конец echo("<hr><br>") # Quit app.quit()
#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 = "localhost:7010"; InitXHE(); // начало echo("<hr><font color=blue>interface.send_mouse_click</font><hr>"); // 1 echo("1. Перейдем в гугл : "); echo(browser.navigate("http://www.google.ru")+"<br>"); // 2 echo("2. Переместим мышь на About' : "); var obj = anchor.get_by_inner_text("About"); echo(obj.mouse_move(10,10)+" "); sleep(4); echo(obj.send_touch(0,1,10,10)+" "); echo(obj.send_touch(0,0,10,10)+"<br>"); // конец echo("\n\n"); app.quit(); } }
// подключим функциональные объекты, если еще не подключен xhe_host="127.0.0.1:7084"; echo=require("../../../Templates JS/init.js"); // начало echo("<hr><font color=blue>interface.send_mouse_click</font><hr>"); // 1 echo("1. Перейдем в гугл : "); echo(browser.navigate("http://www.google.ru")+"<br>"); // 2 echo("2. Переместим мышь на About' : "); var obj = anchor.get_by_inner_text("About"); echo(obj.mouse_move(10,10)+" "); app.sleep(4); echo(obj.send_touch(0,1,10,10)+" "); echo(obj.send_touch(0,0,10,10)+"<br>"); // конец echo("\n"); // Quit app.quit();
=============================================
Interface Объекты DOM System Vision Web Window
=============================================
Если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум.