humanemulator.net — справка.
Продукт, демо и покупка — на
хуманэмулятор.рф
|
Демо
|
Купить
|
API
|
лог изменений
get_all_child_by_xpath
get_all_child_by_xpath($xpath); - получить все дочерние интерфейсы элемента DOM по xpath (доступна с 7.0.57 версии)Функция на вход принимает параметры:
После отработки функция возвращает результат своей работы в скрипт :
Пример использования
<?php // Scenario: For the current page, find a DOM element and get its child DOM elements by XPath expression, and get the inner text of each child object // Description: For the current page, find a DOM element as XHEInterface, and get its child DOM elements by XPath expression as XHEInterfaces, and get the inner text of each child object // Classes used: XHEDiv, XHEBrowser, XHEApplication, XHEInterface, XHEInterfaces // 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, find a DOM element as XHEInterface, and get its child DOM elements by XPath expression as XHEInterfaces, and get the inner text of each child object as an array of strings // Get the div object by 'name' attribute, as XHEInterface $targetDiv = DOM::$div->get_by_attribute('name', 'Name', false); // Get child DOM elements from the current div by XPath expression for searching child div elements, get the result as a collection object of type XHEInterfaces $targetDivChilds = $targetDiv->get_all_child_by_xpath("/div"); // For the collection object of type XHEInterfaces, call the get_inner_text() method on each element of the collection to get its inner text. // As a result of execution, an array of inner text strings for child elements of the current div DOM element will be returned. $targetDivChildInnerTexts = $targetDivChilds->get_inner_text(); // Output all inner texts to the console one by one foreach ($targetDivChildInnerTexts as $childInnerText) echo($childInnerText . "\n"); // Stop the application WINDOW::$app->quit(); ?>
# Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7025" from xweb_human_emulator import * # начало echo("<hr><font color=blue>interface.xxxxxxxxx</font><hr>") # 1 echo("1. Перейдем на полигон : "); echo(browser.navigate("https://rpa-bot.ru/wiki/poligon/anchor.html"),"<br>"); # 2 echo("2. Получить inner text всех ссылок : "); echo(body.get_by_number(0).get_all_child_by_xpath("/a").get_inner_text()); # конец 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_child_by_number</font><hr>"); // 1 echo("1. Перейдем на полигон : "); echo(browser.navigate("https://rpa-bot.ru/wiki/poligon/anchor.html")+"<br>"); // 2 echo("2. Получить inner text всех ссылок : "); echo(body.get_by_number(0).get_all_child_by_xpath("/a").get_inner_text()); // конец echo("\n\n"); app.quit(); } }
// IE + Chrom // подключим функциональные объекты, если еще не подключен xhe_host="127.0.0.1:7025"; echo=require("../../../Templates JS/init.js"); // начало echo("<hr><font color=blue>interface.get_child_by_number</font><hr>"); // 1 echo("1. Перейдем на полигон : "); echo(browser.navigate("https://rpa-bot.ru/wiki/poligon/anchor.html")+"<br>"); // 2 echo("2. Получить inner text всех ссылок : "); echo(body.get_by_number(0).get_all_child_by_xpath("/a").get_inner_text()); // конец echo("\n"); // Quit app.quit();
=============================================
Interface Объекты DOM System Vision Web Window
=============================================
Если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум.