humanemulator.net — справка.
Продукт, демо и покупка — на
хуманэмулятор.рф
|
Демо
|
Купить
|
API
|
Changelog
get_all_by_name
get_all_by_name($name,$exactly=false,$frame="-1"); - Получить все интерфейсы по атрибуту nameФункция на вход принимает параметры:
После выполнения функции возвращаемое значение будет равно одному из двух :
Пример использования
<?php // Scenario: Get all elements by name from a collection // Description: This example demonstrates how to get a collection of elements and then find all elements with a specific name within that collection // Classes used: XHEInterfaces, XHEInput, XHEBrowser, XHEApplication // Connection string to XHE API $xhe_host = getenv("RPABOT_HOST_URL"); // Path to init.php file if (!isset($path)) { // Path to init.php file for connecting to XHE API $path = "../../../Templates/init.php"; // When connecting 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 . "input.html"); // Example: Get all input elements and then find all inputs with a specific name within that collection // Get all input elements on the page $inputs = DOM::$input->get_all(); // Check that we have found at least one input if ($inputs->count() > 0) { echo "Found " . $inputs->count() . " input elements\n"; // Try to find all inputs with a specific name $targetName = "Name"; $inputsByName = $inputs->get_all_by_name($targetName); // Check if any inputs with the specified name were found if ($inputsByName->count() > 0) { echo "\nFound " . $inputsByName->count() . " input elements with name '" . $targetName . "':\n"; // Process each found input for ($k = 0; $k < $inputsByName->count(); $k++) { $currentInput = $inputsByName->get($k); if ($currentInput && $currentInput->is_exist()) { echo "\nInput #" . ($k + 1) . " with name '" . $targetName . "':\n"; echo "Input type: " . $currentInput->get_type() . "\n"; echo "Input value: " . $currentInput->get_value() . "\n"; echo "Input inner number: " . $currentInput->inner_number . "\n"; } } } else { echo "\nNo input elements with name '" . $targetName . "' found in the collection\n"; } } else { echo "No input elements found on the page\n"; } // 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>interfaces.xxxxxxxxx</font><hr>") # 1 echo("1. Перейдем на полигон : ") echo(browser.navigate("https://rpa-bot.ru/wiki/poligon/anchor.html"),"<br>") # 2 echo("2. Получить все ссылки : ") anchors=anchor.get_all() echo(anchors.get_count(),"<br>") # 3 echo("3. Получим внутренний текст ссылок с name, содержащим onmouseover : <br>") anchors_1=anchors.get_all_by_name("onmouseover") print(anchors_1.get_inner_text()) # 4 echo("4. Получим внутренний текст ссылок с name = bigfozzy : <br>") anchors_2=anchors.get_all_by_name("bigfozzy",true) print(anchors_2.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 = Environment.GetEnvironmentVariable("RPABOT_HOST_URL"); InitXHE(); // начало echo("<hr><font color=blue>interfaces.get_all_by_name</font><hr>"); // 1 шаг echo("1. Перейдем на полигон : "); echo(browser.navigate("rpa-bot.ru/wiki/poligon/anchor.html")+"<br>"); // 2 шаг echo("2. Получить все ссылки : "); XHEInterfaces anchors=anchor.get_all(); echo(anchors.get_count()+"<br>"); // 3 шаг echo("3. Получим внутренний текст ссылок с name, содержащим onmouseover : \n\n"); XHEInterfaces anchors_1=anchors.get_all_by_name("onmouseover"); echo(anchors_1.get_inner_text()); // 4 шаг echo("\n4. Получим внутренний текст ссылок с name = bigfozzy : \n\n"); XHEInterfaces anchors_2=anchors.get_all_by_name("bigfozzy",true); echo(anchors_2.get_inner_text()); // конец echo("\n\n"); app.quit(); } }
// подключим функциональные объекты, если еще не подключен xhe_host="127.0.0.1:7010"; echo=require("../../../Templates JS/init.js"); // начало echo("<hr><font color=blue>interface.get_all_by_name</font><hr>"); // 1 шаг echo("1. Перейдем на полигон : "); echo(browser.navigate("https://rpa-bot.ru/wiki/poligon/anchor.html")+"<br>"); // 2 шаг echo("2. Получить все ссылки : "); anchors=anchor.get_all(); echo(anchors.get_count()+"<br>"); // 3 шаг echo("3. Получим внутренний текст ссылок с name, содержащим onmouseover : \n\n"); anchors_1=anchors.get_all_by_name("onmouseover"); echo(anchors_1.get_inner_text()); // 4 шаг echo("\n4. Получим внутренний текст ссылок с name = bigfozzy : \n\n"); anchors_2=anchors.get_all_by_name("bigfozzy",true); echo(anchors_2.get_inner_text()); // конец echo("\n"); // Quit app.quit();
=============================================
Interfaces Объекты DOM System Vision Web Window
=============================================
Если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум.