User Tools

Site Tools


Sidebar



en:objects:browser:commands:paste

paste

paste($text=""); - paste text from the clipboard. (since version 7.0.2, the $text parameter has been added : if the $text parameter is set, the text from this parameter is copied to the clipboard first)

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

    PHP example:

    <?php $xhe_host = "127.0.0.1:7013";
     
    //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
    echo "1.Let's put the text into the buffer:";
    echo $clipboard->put_text("seo")." n";
     
    //2
    echo "2.Go to the page and set focus:";
    echo $browser->navigate("http://google.com")."";
    echo $input->set_focus_by_number(0)." n";
     
    //3
    echo "3.Paste the text from the buffer:";
    echo $browser->paste()." n";
    sleep(2);
     
    //4
    echo "4.Go to the page and set focus:";
    echo $browser->navigate("http://google.com")."";
    echo $input->set_focus_by_number(0)." n";
     
    //five
    echo "5.Paste the text from the buffer:";
    echo $browser->paste("new text");
     
    //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:7013"
    from xweb_human_emulator import *
     
    # Start
    echo("<hr> <font color = blue> browser.xxxxxxxxx </font> <hr>")
     
    # 1
    echo("1.Put the text in the buffer:")
    echo(clipboard.put_text("seo"), "
    ")
     
    # 2
    echo("2.Go to the page and set focus:")
    echo(browser.navigate("http://ya.ru"), "")
    echo(input.set_focus_by_number(0), "
    ")
     
    # 3
    echo("3.Insert text from buffer:")
    echo(browser.paste(), "
    ")
     
    # 4
    echo("4.Go to the page and set focus:")
    echo(browser.navigate("http://ya.ru"), "")
    echo(input.set_focus_by_number(0), "
    ")
     
    # five
    echo("5.Insert text from buffer:")
    echo(browser.paste("new text"))
     
    # 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:7013";
    InitXHE();
     
    //Start
    echo("<hr> <font color = blue> browser.paste </font> <hr>");
     
    //1 step
    echo("1.Let's put the text into the buffer:");
    echo(clipboard.put_text("seo") + "<br>");
     
    //step 2
    echo("2.Let's go to Yandex:");
    echo(browser.navigate("http://ya.ru") + "<br>");
     
    //step 3
    echo("3.Let's focus on the search string:");
    echo(input.set_focus_by_number(0) + "<br>");
     
    //step 4
    echo("4.Insert text from buffer:");
    echo(browser.paste());
     
    //step 5
    echo("5.Let's go to Yandex:");
    echo(browser.navigate("http://ya.ru") + "<br>");
     
    //step 6
    echo("6.Let's focus on the search string:");
    echo(input.set_focus_by_number(0) + "<br>");
     
               //step 7
    echo("7.Set focus to the search string:");
    echo(input.set_focus_by_number(0) + "<br>");
     
    //step 8
    echo("8.Paste the text from the buffer:");
    echo(browser.paste("new text"));
     
    //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:7013";
    echo = require("../../../Templates JS/xweb_human_emulator.js");
     
    //Start
    echo("<hr> <font color = blue> browser.paste </font> <hr>");
     
    //1 step
    echo("1.Let's put the text into the buffer:");
    echo(clipboard.put_text("seo") + " n");
     
    //step 2
    echo("2.Let's go to the page and set the focus:");
    echo(browser.navigate("http://ya.ru") + "");
    echo(input.set_focus_by_number(0) + " n");
     
    //step 3
    echo("3.Insert text from the buffer:");
    echo(browser.paste() + " n");
     
    //step 4
    echo("4.Let's go to the page and set the focus:");
    echo(browser.navigate("http://ya.ru") + "");
    echo(input.set_focus_by_number(0) + " n");
     
    //step 5
    echo("5.Paste the text from the buffer:");
    echo(browser.paste("new text"));
     
    //end
    echo("<hr> <br>");
     
    //Quit
    app.quit();
  • en/objects/browser/commands/paste.txt · Last modified: 2026/08/05 22:32 (external edit)