User Tools

Site Tools


Sidebar

en:objects:mouse:work_with_flash:send_click_to_flash_player

send_click_to_flash_player

send_click_to_flash_player($x,$y,$flash_num,$bUseFlashXY=false,$scroll=true); - this function is used to send a mouse click to a flash element on the current page

The function accepts parameters as input:

  • $x – x - coordinate of the point to send the click to. (int)
  • $y – y - coordinate of the point to send the click to. (int)
  • $flash_num – number of the flash element on the current page. (int)
  • $bUseFlashXY – use the coordinates of the flash element. If true, the $x and $y parameters pass coordinates relative to the upper - left corner of the flash, and if false – relative to the upper-left corner of the browser (boolean)
  • $scroll - whether to scroll the browser to the specified point. If false, the user will simply click at the specified point. if true, the user will automatically scroll to the specified point (boolean).

    If the coordinates are empty, the click is made at the current point.

    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:7062";
     
    //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 the polygon:";
    echo $browser->navigate('http://humanemulator.net/poligon/embed.html')." n"; sleep(3);
     
    //move the mouse to the flash player
    $mouse->move(300,160,1,2);
     
    //2
    echo "2.Send click to flash at browser coordinate(play video):";
    echo $mouse->send_click_to_flash_player(300,160,0, false)." n"; sleep(10);
     
    //3
    echo "3.Get coordinates relative to the flash player:";
    echo $mouse->get_mouse_pos_to_flash_player(0,300,160)." n";
     
    //4
    echo "4.Send a left mouse button click event on the player coordinates:";
    echo $mouse->send_click_to_flash_player(290,150,0, true)." n";
     
    //five
    echo "5.Get the coordinates relative to the flash player for the current cursor position(the cursor must be in the play area):";
    echo $mouse->get_mouse_pos_to_flash_player(0)." n  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:7011"
    from xweb_human_emulator import *
     
    # Start
    echo("<hr> <font color = blue> mouse.xxxxxxxxx </font> <hr>")
     
    # 1
    echo("1.Go to polygon:")
    echo(browser.navigate('http://humanemulator.net/poligon/embed.html'), "
    ")
    sleep(3)
     
    # move the mouse pho flash player
    mouse.move(300,160,1,2)
     
    # 2
    echo("2.Send click to flash at browser coordinate(play video):")
    echo(mouse.send_click_to_flash_player(300,160,0, false), "
    ")
    sleep(10)
     
    # 3
    echo("3.Get coordinates relative to flash player:")
    echo(mouse.get_mouse_pos_to_flash_player(0,300,160), "
    ")
     
    # 4
    echo("4.Send a left mouse button click event on the player coordinates:")
    echo(mouse.send_click_to_flash_player(290,150,0, true), "
    ")
     
    # five
    echo("5.Get the coordinates relative to the flash player for the current cursor position(the cursor must be in the play area):")
    echo(mouse.get_mouse_pos_to_flash_player(0), "
     
    ")
     
    # 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:7010";
    InitXHE();
     
    //Start
    echo("<hr> <font color = blue> mouse.send_click_to_flash_player </font> <hr>");
     
    //go to polygon
    browser.navigate('http://humanemulator.net/poligon/embed.html');
     
    //send a click event of the left mouse button at the browser coordinate
    echo("mouse.send_click_to_flash_player(254,149,0, false) +" <br> ");
    sleep(3);
     
    //get coordinates relative to flash player
    echo("mouse.get_mouse_pos_to_flash_player(0," 240 "," 165 ");
    echo("<br>");
     
    //send an event of clicking the left mouse button on the player coordinate
    echo("mouse.send_click_to_flash_player(11,301,0, true) +" <br> ");
    sleep(1);
     
    //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:7010";
    echo = require("../../../Templates JS/xweb_human_emulator.js");
     
    //Start
    echo("<hr> <font color = blue> mouse.send_click_to_flash_player </font> <hr>");
     
    //1 step
    echo("1.Go to the polygon:");
    echo(browser.navigate('http://humanemulator.net/poligon/embed.html') + " n");
    browser.sleep(3);
     
    //move the mouse to the flash player
    mouse.move(300,160,1,2);
     
    //step 2
    echo("2.Send click to flash at browser coordinate(play video):");
    echo(mouse.send_click_to_flash_player(300,160,0, false) + " n");
    browser.sleep(10);
     
    //step 3
    echo("3.Get coordinates relative to the flash player:");
    echo(mouse.get_mouse_pos_to_flash_player(0,300,160) + " n");
     
    //step 4
    echo("4.Send a left mouse button click event on the player coordinates:");
    echo(mouse.send_click_to_flash_player(290,150,0, true) + " n");
     
    //step 5
    echo("5.Get the coordinates relative to the flash player for the current cursor position(the cursor must be in the play area):");
    echo(mouse.get_mouse_pos_to_flash_player(0) + " n");
     
    //end
    echo("<hr> <br>");
     
    //Quit
    app.quit();
  • en/objects/mouse/work_with_flash/send_click_to_flash_player.txt · Last modified: 2020/10/14 12:50 (external edit)