humanemulator.net — справка.
Продукт, демо и покупка — на
хуманэмулятор.рф
|
Демо
|
Купить
|
API
|
лог изменений
check
check($needChecked = true); - чекнуть через DOM модель элемент (доступна с 6.0.37)Функция на вход принимает параметры:
После отработки функция возвращает результат своей работы в скрипт (тип возвращаемого значения boolean):
Пример использования
<?php // Scenario: For the current page, find a DOM element checkbox and set a mark on it // Description: For the current page, find a DOM element <input type="checkbox"> and for the found checkbox, set or remove the mark // Classes used: XHECheckButton, 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 . "checkbox.html"); // Example 1: Find the DOM element checkbox and set a mark on it. // Get the input object with type checkbox by serial number 1 among inputs of this type and get it as XHEInterface $targetCheckBox = DOM::$checkbox->get_by_number(1); // Check that the DOM element is received if ($targetCheckBox->inner_number != -1) { // For the found checkbox, set the mark (add the checked attribute) $targetCheckBox->check(true); } // Example 2: Find the DOM element checkbox and remove the mark from it. // Get the input object with type checkbox by serial number 1 among inputs of this type and get it as XHEInterface $targetCheckBox = DOM::$checkbox->get_by_number(1); // Check that the DOM element is received if ($targetCheckBox->inner_number != -1) { // For the found checkbox, remove the mark (remove the checked attribute) $targetCheckBox->check(false); } // Stop the application WINDOW::$app->quit(); ?>
# Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7014" 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/checkbox.html"),"<br>") # 2 echo("2. Чекнем : "); echo(checkbox.get_by_number(4).check(),"<br>") # 3 echo("3. Получим чекнутость : "); echo(checkbox.get_by_number(4).is_checked(),"<br>") sleep(2); # 4 echo("4. Уберем чекнутость : "); echo(checkbox.get_by_number(4).check(false),"<br>") # 5 echo("5. Получим чекнутость : "); if not checkbox.get_by_number(4).is_checked(): echo("не чекнут") # конец 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.check</font><hr>"); // чтобы быстрее browser.set_wait_params(5,1); // 1 echo("1. Перейдем на полигон : "); echo(browser.navigate("https://rpa-bot.ru/wiki/poligon/checkbox.html")+"<br>"); // 2 echo("2. Чекнем : "); echo(checkbox.get_by_number(4).check()+"<br>"); // 3 echo("3. Получим чекнутость : "); echo(checkbox.get_by_number(4).is_checked()+"<br>"); sleep(2); // 4 echo("4. Уберем чекнутость : "); echo(checkbox.get_by_number(4).check(false)+"<br>"); // 5 echo("5. Получим чекнутость : "); if (!checkbox.get_by_number(4).is_checked()) echo("не чекнут"); // конец echo("\n\n"); // Quit app.quit(); } }
// подключим функциональные объекты, если еще не подключен xhe_host="127.0.0.1:7014"; echo=require("../../../Templates JS/init.js"); // начало echo("<hr><font color=blue>interface.check</font><hr>"); // чтобы быстрее browser.set_wait_params(5,1); // 1 echo("1. Перейдем на полигон : "); echo(browser.navigate("https://rpa-bot.ru/wiki/poligon/checkbox.html")+"<br>"); // 2 echo("2. Чекнем : "); echo(checkbox.get_by_number(4).check()+"<br>"); // 3 echo("3. Получим чекнутость : "); echo(checkbox.get_by_number(4).is_checked()+"<br>"); app.sleep(2); // 4 echo("4. Уберем чекнутость : "); echo(checkbox.get_by_number(4).check(false)+"<br>"); // 5 echo("5. Получим чекнутость : "); if (!checkbox.get_by_number(4).is_checked()) echo("не чекнут"); // конец echo("\n"); // Quit app.quit();
=============================================
Interface Объекты DOM System Vision Web Window
=============================================
Если что-то непонятно или необходимо узнать или считаете что надо добавить по работе этой функции, пишите в комментарии или на наш форум.