send_touch

send_touch($id,$touch_type,$x,$y,$radiusX=0,$radiusY=0,$rotationAngle=0,$pressure=0,$modiefiers=0,$pointerType=0) - emulate finger tapping (interaction) in the browser at the event level relative to the upper-left corner of the browser ( available from 7.0.35 )

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
  • $x – X – axis offset relative to the upper – left corner of the browser
  • $y - Y-axis Offset relative to the upper-left corner of the browser
  • $radiusX - radius of the click spot on the X-axis (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 – press 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:7010";
     
    //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> mouse->".basename(__FILE__)."</font> <hr>";
     
    //1
    echo "1.Go to yahoo:";
    echo $browser->navigate("http://www.yahoo.ru")."<br>";
     
    //2
    echo "2.Touch at point 500,500:";
    echo $mouse->move(500,500)."";
    echo $mouse->send_touch(0,1,500,500)."";
    echo $mouse->send_touch(0,0,500,500)." n";
     
    //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:7080"
    from xweb_human_emulator import *
     
    # Start
    echo("<hr> <font color = blue> mouse.xxxxxxxxx </font> <hr>")
     
    # 1
    echo("1.Let's go to yahoo:")
    echo(browser.navigate("http://www.yahoo.com"), "<br>")
    browser.set_zoom(200)
     
    # 2
    echo("2.Touch at point 500,500:")
    echo(mouse.send_touch(0,1,300,300), "")
    echo(mouse.send_touch(0,0,300,300), "
    ")
     
    # 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();
     
    //Start
    echo("<hr> <font color = blue> mouse.move </font> <hr>");
     
                //1
                 echo("1.Let's go to yahoo:");
                 echo(browser.navigate("http://www.yahoo.com") + "<br>");
     
    //2
    echo("2.Touch at point 500,500:");
    echo(mouse.send_touch(0,1,500,500) + "");
    echo(mouse.send_touch(0,0,500,500) + " n");
     
    //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:7011";
    echo = require("../../../Templates JS/xweb_human_emulator.js");
     
    //Start
    echo("<hr> <font color = blue> mouse.send_move </font> <hr>");
     
    //1 step
    echo("1.Let's go to yahu:");
    echo(browser.navigate("http://www.yahoo.com") + "<br>");
     
    //2
    echo("2.Touch at point 500,500:");
    echo(mouse.send_touch(0,1,100,100) + "");
    echo(mouse.send_touch(0,0,100,100) + " n");
     
    //end
    echo("<hr> <br>");
     
    //Quit
    app.quit();