humanemulator.net . , . | | | API |

send_mouse_move

send_mouse_move($dx=-1,$dy=-1); - Перемещение мышью

Функция на вход принимает параметры:

  • $dx – Смещение по оси X относительно левого верхнего угла элемента
  • $dy – Смещение по оси Y относительно левого верхнего угла элемента

    После выполнения функции возвращаемое значение будет равно одному из двух :
  • true – успешно
  • false – не удалось

    Пример использования
    <?php
    // Scenario: Demonstrates how to send mouse move event to a UI element
    
    $xhe_host = getenv("RPABOT_HOST_URL");
    if (!isset($path)){
        // Path to the init.php file for connecting to the XHE API
        $path = "../../../Templates/init.php";
        // Including init.php grants access to all classes and functionality for working with the XHE API
        require($path);
    }
    
    // Step: Get UI element for interaction
    $windowText = "localhost";
    $xheElement = WINDOW::$window->get_by_text($windowText)->get_ui_element();
    
    // Step: Find a specific element to move to (Quick Start button)
    $propertyName = "Name";
    $propertyValue = "Quick Start";
    $quickStartElement = $xheElement->get_by_property($propertyName, $propertyValue);
    
    if ($quickStartElement && $quickStartElement->is_exist()) {
        // Example 1: Send mouse move event
        $result = $quickStartElement->send_mouse_move();
        
        if ($result) {
            echo("Example 1: Successfully sent mouse move event\n");
            echo("Mouse cursor is now positioned over the Quick Start element\n");
        } else {
            echo("Example 1: Failed to send mouse move event\n");
        }
    } else {
        echo("Example 1: Quick Start element not found\n");
    }
    
    // Quit the application
    WINDOW::$app->quit();
    ?>

    =============================================
    ui    Объекты    DOM  System  Vision  Web  Window        
    =============================================
    если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум
    .