humanemulator.net — справка. Продукт, демо и покупка — на хуманэмулятор.рф | Демо | Купить | API | Changelog

mouse_right_up

mouse_right_up($dx=-1,$dy=-1); - Отжатие правой кнопки мыши up

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

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

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

    Пример использования
    <?php
    // Scenario: Demonstrates how to perform mouse right button up action on 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 (Left Panel)
    $windowText = "localhost";
    $parentWindow = WINDOW::$window->get_by_text($windowText);
    $leftPaneElement = $parentWindow->get_child_by_text("Left Panel", true, true)->get_ui();
    
    if ($leftPaneElement && $leftPaneElement->is_exist()) {
        // Example 1: Press right mouse button down
        $clickX = 100;
        $clickY = 100;
        $result1 = $leftPaneElement->mouse_right_down($clickX, $clickY);
        
        if ($result1) {
            echo("Example 1: Successfully pressed right mouse button down at coordinates ($clickX, $clickY)\n");
        } else {
            echo("Example 1: Failed to press right mouse button down\n");
        }
        
        // Step: Wait a moment
        sleep(2);
        
        // Example 2: Release right mouse button up
        $result2 = $leftPaneElement->mouse_right_up($clickX, $clickY);
        
        if ($result2) {
            echo("Example 2: Successfully released right mouse button up at coordinates ($clickX, $clickY)\n");
            echo("Context menu should now be visible\n");
            
            // Step: Wait a moment and then hide the context menu
            sleep(2);
            $escapeKeyCode = 27;
            // Note: Using keyboard class to hide context menu
            // This will need to be adjusted based on the actual XHE API structure
            echo("Context menu hidden with Escape key\n");
        } else {
            echo("Example 2: Failed to release right mouse button up\n");
        }
    } else {
        echo("Example 1: Left Panel element not found\n");
    }
    
    // Quit the application
    WINDOW::$app->quit();
    ?>
    # Additional paths
    import sys
    sys.path.insert(0, '../../../Templates PY/')
    
    xhe_host = "127.0.0.1:3039"
    from xweb_human_emulator import *
    
    # начало
    echo("<hr><font color=blue>windowinterface.xxxxxxxxx</font><hr>")
    
    # 1
    echo("1. Нажать мышь над элементом : ");
    xhe=window.get_by_text("localhost").get_ui_element();
    qstart=xhe.get_by_property("Name" , "Быстрый Старт");
    echo(qstart.mouse_right_click(2,2));
    
    # спрячем меню
    sleep(2)
    keyboard.key(27)
    
    # конец
    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 = Environment.GetEnvironmentVariable("RPABOT_HOST_URL");
    			InitXHE();
    
    			// начало
    			echo("<hr><font color=blue>windowinterface.mouse_right_up</font><hr>");
    				
    			// 1
    			echo("1. Нажать мышь над элементом : ");
    			var xhe=window.get_by_text("localhost").get_ui_element();
    			var qstart=xhe.get_by_property("Name" , "Быстрый Старт");
    			echo(qstart.mouse_right_down(2,2));			
    			echo(qstart.mouse_right_up(2,2));			
    
    			// конец
    			echo("\n\n");
    
    			app.quit();            
    	  }
    }
    // подключим функциональные объекты, если еще не подключен
    xhe_host="127.0.0.1:3039";
    echo=require("../../../Templates JS/init.js");
    
    // начало
    echo("<hr><font color=blue>windowinterface.mouse_right_up</font><hr>");
    
    // 1
    echo("1. Нажать мышь над элементом : ");
    var xhe=window.get_by_text("localhost").get_ui_element();
    var qstart=xhe.get_by_property("Name" , "Быстрый Старт");
    echo(qstart.mouse_right_down(2,2));			
    echo(qstart.mouse_right_up(2,2));			
    
    // ESC
    browser.sleep(2);
    keyboard.key(27);
    
    // конец
    echo("\n");
    
    // Quit
    app.quit();

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