humanemulator.net — справка.
Продукт, демо и покупка — на
хуманэмулятор.рф
|
Демо
|
Купить
|
API
|
лог изменений
get_prev
get_prev(); - получить интерфейс предыдущего элемента DOM (доступна с 6.0.46 версии)После отработки функция возвращает результат своей работы в скрипт :
Пример использования
<?php // Scenario: For current page, find a DOM element and get the previous element in the DOM tree // Description: For the current page, find a DOM element and get the previous element in the DOM tree // 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 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: Get tag and number of the next element // Get the anchor object by 'name' attribute, as XHEInterface $targetAnchor = DOM::$anchor->get_by_name("carnote"); // Check that the DOM element is received if ($targetAnchor->inner_number != -1) { // Get the next element in the DOM tree $nextElement = $targetAnchor->get_next(); // Check that the next element is received if ($nextElement->inner_number != -1) { // Get tag and number of next element echo($nextElement->get_tag() . " " . $nextElement->get_number("element") . "\n"); } } // Example 2: Get tag and number of the previous element // Get the anchor object by 'name' attribute, as XHEInterface $targetAnchor = DOM::$anchor->get_by_name("carnote"); // Check that the DOM element is received if ($targetAnchor->inner_number != -1) { // Get the previous element in the DOM tree $prevElement = $targetAnchor->get_prev(); // Check that the previous element is received if ($prevElement->inner_number != -1) { // Get tag and number of previous element echo($prevElement->get_tag() . " " . $prevElement->get_number("element") . "\n"); } } // Example 3: Get tag and number of the current element // Get the anchor object by 'name' attribute, as XHEInterface $targetAnchor = DOM::$anchor->get_by_name("carnote"); // Check that the DOM element is received if ($targetAnchor->inner_number != -1) { // Get tag and number of current element echo($targetAnchor->get_tag() . " " . $targetAnchor->get_number("element") . "\n"); } // Stop the application WINDOW::$app->quit(); ?>
# Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7031" 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. Получим тэг и номер следующего элемента : ") obj_a=anchor.get_by_name("carnote") obj_p=obj_a.get_next() echo(obj_p.get_tag()," ") echo(obj_p.get_number("element"),"\n") # 3 echo("3. Получим тэг и номер предыдущего элемента : ") obj_p=obj_a.get_prev() echo(obj_p.get_tag()," ") echo(obj_p.get_number("element"),"\n") # 2 echo("2. Получим тэг и номер текущего элемента : ") echo(obj_a.get_tag()," ") echo(obj_a.get_number("element")) # конец 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_prev</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. Получим тэг и номер следующего : "); XHEInterface obj_a=anchor.get_by_name("carnote"); XHEInterface obj_p=obj_a.get_next(); echo(obj_p.get_tag()+" "+obj_p.get_number("element")+"\n"); // 3 echo("3. Получим тэг и номер предыдущего : "); obj_p=obj_a.get_prev(); echo(obj_p.get_tag()+" "+obj_p.get_number("element")+"\n"); // 4 echo("4. Получим тэг и номер текущего : "); echo(obj_a.get_tag()+" "+obj_a.get_number("element")+"\n"); // конец echo("\n\n"); app.quit(); } }
// IE + Chrom // подключим функциональные объекты, если еще не подключен xhe_host="127.0.0.1:7031"; echo=require("../../../Templates JS/init.js"); // начало echo("<hr><font color=blue>interface.get_prev</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. Получим тэг и номер следующего : "); var obj_a=anchor.get_by_name("carnote"); var obj_p=obj_a.get_next(); echo(obj_p.get_tag()+" "+obj_p.get_number("element")+"\n"); // 3 echo("3. Получим тэг и номер предыдущего : "); obj_p=obj_a.get_prev(); echo(obj_p.get_tag()+" "+obj_p.get_number("element")+"\n"); // 4 echo("4. Получим тэг и номер текущего : "); echo(obj_a.get_tag()+" "+obj_a.get_number("element")+"\n"); // конец echo("\n"); // Quit app.quit();
=============================================
Interface Объекты DOM System Vision Web Window
=============================================
Если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум.