User Tools

Site Tools


Sidebar

en:objects:interface:send_mouse:send_touch

send_touch

send_touch($id,$touch_type,$dx,$dy,$radiusX=0,$radiusY=0,$rotationAngle=0,$pressure=0,$modiefiers=0,$pointerType=0); - emulate finger tapping (interaction) on an element at the event level relative to the upper-left corner of the element ( available from 7.0.37 )

The function accepts parameters as input:

  • $id – interaction ID (finger) (from 0 to 16)
  • $touch_type – interaction type : Released = 0, Pressed = 1, Moved = 2, canceled = 3
  • $dx – X – axis offset relative to the upper – left corner of the element
  • $dy - Y-axis Offset relative to the upper-left corner of the element
  • $radiusX - radius of the click spot x-axes (in Pixels)
  • $radiusX – radius of the click spot on the Y axis (in pixels)
  • $rotationAngle – rotation angle (in radians), when the value is 0 - the parameter is not used
  • $pressure – pressing pressure (from 0 to 1), when the value is 0 - the parameter is not used
  • $modiefiers – keyboard modifier flags, summed by logical or (0 - None, 1 - CapsLockOn, 2 - ShiftDown, 4 - ControlDown, 8 - AltDown, 16 - LeftMouseButton, 32 - middlemousebutton, 64 - rightmousebutton, 128 - commanddown, 256 - numlockon, 512 - iskeypad, 1024 - isleft, 2048 - isright )
  • $pointerType – pointer type (0 - Touch, 1 - Mouse, 2 - Pen, 3 - Eraser, 4 - Unknown)

    After testing, the function returns the result of its work to the script :
  • true – successfully clicked at the specified point(boolean)
  • false – operation failed (boolean)

    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> interface->".basename(__FILE__)."</font> <hr>";
     
    //1
    echo "1.Let's go to Google:";
    echo $browser->navigate("http://www.google.ru")."<br>";
     
    //2
    echo "2.Move the mouse to 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>";
     
    //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:7084"
    from xweb_human_emulator import *
     
    # Start
    echo("<hr> <font color = blue> interface.xxxxxxxxx </font> <hr>")
     
    # 1
    echo("1.Let's go to Google:");
    echo(browser.navigate("http://www.google.ru"), "<br>");
     
    # 2
    echo("2.Move the mouse to 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>");
     
    # 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:7084";
    InitXHE();
     
    //Start
    echo("<hr> <font color = blue> interface.send_mouse_click </font> <hr>");
     
    //1
    echo("1.Let's go to Google:");
    echo(browser.navigate("http://www.google.ru") + "<br>");
     
    //2
    echo("2.Move the mouse to 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>");
     
    //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:7084";
    echo = require("../../../Templates JS/xweb_human_emulator.js");
     
    //Start
    echo("<hr> <font color = blue> interface.send_mouse_click </font> <hr>");
     
    //1
    echo("1.Let's go to Google:");
    echo(browser.navigate("http://www.google.ru") + "<br>");
     
    //2
    echo("2.Move the mouse to 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>");
     
    //end
    echo("<hr> <br>");
     
    //Quit
    app.quit();
  • en/objects/interface/send_mouse/send_touch.txt · Last modified: 2026/08/05 22:45 (external edit)