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

get_clone

get_clone(); - получить клон DOM интерфейса (доступна с 4.6.36)

После отработки функция возвращает результат своей работы в скрипт :
  • DOM интерфейс элемента – объект позволяющий быстро выполнять любые операции с найденным элементом, тип возвращаемого значения XHEInterface

    Пример использования
    <?php
    
    // Scenario: For the current page, find a DOM element as an object and clone this object
    // Description: For the current page, find a DOM element <a> as an object and clone this object
    // Classes used: XHEAnchor, XHEInterface, XHEBrowser, XHEApplication
    
    // Connection string to XHE API
    $xhe_host = "localhost:7010";
    
    // Path to init.php file
    if (!isset($path))
    {
        // Path to init.php file for connecting to XHE API
        $path = "../../../Templates/init.php";
        // When connecting the init.php file, all functionality of classes for working with XHE API will be available
        require($path);
    }
    
    // Navigate to the polygon page if the page was not loaded earlier
    WEB::$browser->navigate(TEST_POLYGON_URL . "anchor.html");
    
    // Example 1: For the current page, get DOM element <a> by 'href' attribute, as XHEInterface object, and make a clone of the object
    
    // For the current page, get DOM element as XHEInterface object <a> by 'href' attribute, attribute value is not an exact match
    $targetAnchor = DOM::$anchor->get_by_attribute("href",'site.com',false);
    
    // Make a clone of the XHEInterface object into a variable
    $cloneAnchorObject = $targetAnchor->get_clone();
    
    
    // Stop the application
    WINDOW::$app->quit();
    ?>
    # Additional paths
    import sys
    sys.path.insert(0, '../../../Templates PY/')
    
    xhe_host = "127.0.0.1:7010"
    from xweb_human_emulator import *
    
    # начало
    echo("<hr><font color=blue>interface.xxxxxxxxx</font><hr>")
    
    # чтобы быстрее
    browser.set_wait_params(5,1)
    
    # 1 
    echo("1. Перейдем на полигон : ")
    echo(browser.navigate("https://rpa-bot.ru/wiki/poligon/anchor.html"),"<br>")
    
    # 2 
    echo("2. Щелкнем по элементу с href равным https://rpa-bot.ru/wiki/ : ")
    bigfozzy=0
    obj1 = anchor.get_by_attribute("href","https://rpa-bot.ru/wiki/",true)
    bigfozzy=obj1.get_clone()
    echo(bigfozzy.click())
    
    # конец
    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 = "localhost:7010";
    			InitXHE();
    
    			// начало
    			echo("<hr><font color=blue>interface.get_by_attribute</font><hr>");
    							
    			// чтобы быстрее
    			browser.set_wait_params(5,1);
    			
    			// 1 шаг
    			echo("1. Перейдем на полигон : ");
    			echo(browser.navigate("rpa-bot.ru/wiki/poligon/anchor.html")+"<br>");
    			
    			// 2 шаг
    			echo("2. Щелкнем по элементу с href равным http://rpa-bot.ru/wiki/ : ");
    			XHEInterface bigfozzy=null;
    			{
    				XHEInterface obj1=anchor.get_by_attribute("href","http://rpa-bot.ru/wiki/",true);
    				bigfozzy=obj1.get_clone();
    			}
    			echo(bigfozzy.click());
    
    			// конец
    			echo("\n\n");
    
    			app.quit();            
    	  }
    }
    // IE + Chrom
    
    // подключим функциональные объекты, если еще не подключен
    xhe_host="127.0.0.1:7010";
    echo=require("../../../Templates JS/init.js");
    
    // начало
    echo("<hr><font color=blue>interface.get_clone</font><hr>");
    
    // чтобы быстрее
    browser.set_wait_params(5,1);
    
    // 1 шаг
    echo("1. Перейдем на полигон : ");
    echo(browser.navigate("https://rpa-bot.ru/wiki/poligon/anchor.html")+"<br>");
    
    // 2 шаг
    echo("2. Щелкнем по элементу с href равным https://rpa-bot.ru/wiki/ : ");
    bigfozzy=null;
    {
    	obj1=anchor.get_by_attribute("href","https://rpa-bot.ru/wiki/",true);
        bigfozzy=obj1.get_clone();
    }
    echo(bigfozzy.click());
    
    // конец
    echo("\n");
    
    // Quit
    app.quit();

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