send_key_down

send_key_down($key,$is_key); - this function is used to emulate pressing a given key on the keyboard at the event level, relative to the current window (input focus is passed to the current window when this function is called) (available from 4.6.37)

The function accepts parameters as input:

  • $key – the key to be pressed.

    After testing, the function returns the result of its work to the script :
  • true – emulation was made
  • false – emulation was not successful

    PHP example: keyboard->".basename(__FILE__)."
    "; //1 echo "1.Let's add text to navigation by the first letter:"; $navigate = $window->get_by_text("XWeb", false)->get_child_by_number(0)->get_child_by_class("XTPToolBar")->get_child_by_class("RichEdit"); echo $navigate->send_key_down(89,1)."".$navigate->send_key_down(65,1).""; sleep(2); echo $navigate->key(13)."
    "; sleep(1); //end echo "

    "; //Quit $app->quit(); ?>
    Python example: # Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7012" from xweb_human_emulator import * # Start echo("
    windowinterface.xxxxxxxxx
    ") # 1 echo("1.Let's set the text in the first letter navigation:") navigate = window.get_by_text("XWeb", false) .get_child_by_number(0) .get_child_by_class("XTPToolBar").get_child_by_class("RichEdit") echo(navigate.send_key_down(89,1), "") echo(navigate.send_key_down(65,1), "") sleep(2) echo(navigate.key(13), "
    ") sleep(1) # end echo("

    ") # Quit app.quit()
    C# example: #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 = "127.0.0.1:7010"; InitXHE(); //Start echo("
    windowinterface.send_key_down
    "); //1 step echo("1.Let's set the text in the navigation by the first letter:"); XHEWindowInterface navigate = window.get_by_text("XWeb", false) .get_child_by_number(0) .get_child_by_class("XTPToolBar").Get_child_by_class("RichEdit"); echo(navigate.send_key_down("89", true) + "" + navigate.send_key_down("65", true) + ""); sleep(2); echo(navigate.key(13) + "
    "); sleep(1); //end echo("

    "); app.quit(); } }
    Java Script example: //connect the object to control the emulator, if not already connected xhe_host = "127.0.0.1:7010"; echo = require("../../../Templates JS/xweb_human_emulator.js"); //Start echo("
    keyboard.send_key_down
    "); //1 step echo("1.Let's set the text in the navigation by the first letter:"); navigate = window.get_by_text("XWeb", false) .get_child_by_number(0) .get_child_by_class("XTPToolBar").get_child_by_class("RichEdit"); echo(navigate.send_key_down(89,1) + "" + navigate.send_key_down(65,1) + ""); browser.sleep(2); echo(navigate.key(13) + "
    "); browser.sleep(1); //end echo("

    "); //Quit app.quit();