set_body

set_body($body); - set a new page content (for better performance ,it is advisable to use it immediately after navigation)

the input Function accepts parameters:

  • $body – new body (body tag) of the page

    After testing, the function returns the result of its work to the script :
  • true – operation completed successfully
  • false – operation failed to complete successfully

    PHP example: webpage->".basename(__FILE__)."
    "; //1 echo "1.Let's go to the polygon:"; echo $browser->navigate("http://www.humanemulator.net/poligon/anchor.html")."
    "; //2 echo "2.Replace the script message:"; $body = $webpage->get_body(); $body = str_replace("mouse down", "mouse down changed body", $body); $body = str_replace("mousedown", "mouse down changed body", $body); $body = str_replace("3", "1", $body); echo $webpage->set_body("New").""; sleep(2); echo $webpage->set_body($body)."
    "; //3 echo "3.Send an event to the changed element:"; echo $anchor->send_event_by_name("onmousedown", "onmousedown")."
    "; //4 echo "4.Get the text of the last message(even if it was hidden):"; echo $browser->get_last_messagebox_text(); //end echo "

    "; //Quit $app->quit(); ?>
    Python example: # Additional paths import sys sys.path.insert(0, '../../../Templates PY/') xhe_host = "127.0.0.1:7029" from xweb_human_emulator import * # Start echo("
    webpage.xxxxxxxxx
    ") # 1 echo("1.Let's go to the polygon:") echo(browser.navigate("http://www.humanemulator.net/poligon/anchor.html"), "
    ") # 2 echo("2.Replace the script message:") body = webpage.get_body(); body = body.replace("onmouseover", "onmouseovernew"); echo(webpage.set_body(body), "
    ") # 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:7031"; InitXHE(); //Start echo("
    webpage.set_body
    "); //1 step echo("1.Let's go to the polygon:"); echo(browser.navigate("http://www.humanemulator.net/poligon/anchor.html") + "
    "); //step 2 echo("2.Replace the script message:"); string body = webpage.get_body(); body = body.Replace("mousedown", "mouse down changed body"); echo(webpage.set_body(body) + "
    "); //step 3 echo("3.Send an event to the changed element:"); echo(anchor.send_event_by_name("onmousedown", "onmousedown") + "
    "); //step 4 echo("4.Get the text of the last message(even if it was hidden):"); echo(browser.get_last_messagebox_text()); //end echo("

    "); app.quit(); } }
    Java Script example: //connect the object to control the emulator, if not already connected xhe_host = "127.0.0.1:7029"; echo = require("../../../Templates JS/xweb_human_emulator.js"); //Start echo("
    webpage.set_body
    "); //1 step echo("1.Let's go to the polygon:"); echo(browser.navigate("http://www.humanemulator.net/poligon/anchor.html") + "
    "); //step 2 echo("2.Replace the script message:"); bdy = webpage.get_body(); bdy = bdy.replace("mousedown", "mouse down changed body"); bdy = bdy.replace("3", "1"); echo(webpage.set_body("New") + ""); browser.sleep(2); echo(webpage.set_body(bdy) + "
    "); //step 3 echo("3.Send an event to the changed element:"); echo(anchor.send_event_by_name("onmousedown", "onmousedown") + "
    "); //step 4 echo("4.Get the text of the last message(even if it was hidden):"); echo(browser.get_last_messagebox_text()); //end echo("

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