save_profile

save_profile($path,$name="",$description=""); - save all browser profile settings to a separate profile file.(Available from version 7.0.12)

the Function accepts parameters as input:

  • $path – path to the file to save the profile
  • $name - the profile name that will be displayed in the profile dialog
  • $description – profile description to be displayed in the profile dialog

    After testing, the function returns the result of its work to the script:
  • true - successfully set
  • false - failed to set

    PHP example:

    <?php $xhe_host = "127.0.0.1:7057";
     
    //connect the object to control the emulator, if not already connected
    if(!isset($path))
      $path = "../../../Templates/xweb_human_emulator.php";
    require($path);
     
    //Start
    echo "<hr> <font color = blue> browser->".basename(__FILE__)."</font> <hr>";
     
    //1 step
    echo "1.Let's set the browser parameters:";
    echo $browser->set_user_agent("5Googlebot/2.1(+ http://www.google.com/bot.html)")."";
    echo $browser->set_screen_resolution(1024,768,16)."";
    echo $browser->set_language("en")." n";
     
    //step 2
    echo "2.Let's see the parameters:";
    echo $browser->navigate("whoer.net/extended")." n";
     
    //step 3
    echo "2.Save the profile:";
    echo $browser->save_profile("active_page_profile.json")." n";
     
    //step 4
    echo "4.Add a bookmark:";
    echo $browser->add_tab()." n";
     
    //step 5
    echo "5.Install the same profile on it:";
    echo $browser->load_profile("active_page_profile.json")." n";
     
    //step 6
    echo "6.Let's see the parameters:";
    echo $browser->navigate("whoer.net/extended")." n";
     
    //end
    echo "<hr> <br>";
     
    //Quit
    $app->quit();
    ?>

    Python example:

    # Additional paths
    import sys
    sys.path.insert(0, '../../../Templates PY/')
     
    xhe_host = "127.0.0.1:7010"
    from xweb_human_emulator import *
     
    # Start
    echo("<hr> <font color = blue> browser.xxxxxxxxx </font> <hr>")
     
    # 1 step
    echo("1.Let's set the browser parameters:");
    echo(browser.set_user_agent("5Googlebot/2.1(+ http://www.google.com/bot.html)"), "");
    echo(browser.set_screen_resolution(1024,768,16), "");
    echo(browser.set_language("en"), "
    ");
     
    # 2 step
    echo("2.Let's see the parameters:");
    echo(browser.navigate("whoer.net/extended"), "
    ");
     
    # 3 step
    echo("2.Save the profile:");
    echo(browser.save_profile("active_page_profile.json"), "
    ");
     
    # 4 step
    echo("4.Add a bookmark:");
    echo(browser.add_tab(), "
    ");
     
    # 5 step
    echo("5.Install the same profile on it:");
    echo(browser.load_profile("active_page_profile.json"), "
    ");
     
    # 6 step
    echo("6.Let's see the parameters:");
    echo(browser.navigate("whoer.net/extended"), "
    ");
     
    # end
    echo("<hr> <br>")
     
    # 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("<hr> <font color = blue> browser.set_width </font> <hr>");
     
               //1 step
                echo("1.Let's set the browser parameters:");
                echo(browser.set_user_agent("5Googlebot/2.1(+ http://www.google.com/bot.html)") + "");
                echo(browser.set_screen_resolution(1024,768,16) + "");
                echo(browser.set_language("en") + " n");
     
               //step 2
                echo("2.Let's see the parameters:");
                echo(browser.navigate("whoer.net/extended") + " n");
     
               //step 3
                echo("2.Save the profile:");
                echo(browser.save_profile("active_page_profile.json") + " n");
     
               //step 4
                echo("4.Add a bookmark:");
                echo(browser.add_tab() + " n");
     
               //step 5
                echo("5.Install the same profile on it:");
                echo(browser.load_profile("active_page_profile.json") + " n");
     
               //step 6
                echo("6.Let's see the parameters:");
                echo(browser.navigate("whoer.net/extended") + " n");
     
    //end
    echo("<hr> <br>");
     
    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("<hr> <font color = blue> browser.set_width </font> <hr>");
     
    //1 step
    echo("1.Let's set the browser parameters:");
    echo(browser.set_user_agent("5Googlebot/2.1(+ http://www.google.com/bot.html)"), "");
    echo(browser.set_screen_resolution(1024,768,16), "");
    echo(browser.set_language("en"), " n");
     
    //step 2
    echo("2.Let's see the parameters:");
    echo(browser.navigate("whoer.net/extended"), " n");
     
    //step 3
    echo("2.Save the profile:");
    echo(browser.save_profile("active_page_profile.json"), " n");
     
    //step 4
    echo("4.Add a bookmark:");
    echo(browser.add_tab(), " n");
     
    //step 5
    echo("5.Install the same profile on it:");
    echo(browser.load_profile("active_page_profile.json"), " n");
     
    //step 6
    echo("6.Let's see the parameters:");
    echo(browser.navigate("whoer.net/extended"), " n");
     
    //end
    echo("<hr> <br>");
     
    //Quit
    app.quit();