User Tools

Site Tools


Sidebar



en:objects:app:captcha_dlg:dlg_captcha_from_image_number

dlg_captcha_from_image_number

dlg_captcha_from_image_number($number,$frame=-1); - this function is used to create a dialog-enter captcha by image number

The function accepts parameters as input:

  • $number – image number on the current page
  • $frame – frame number on the current page

    After testing, the function returns the result of its work to the script :
  • Captcha entered – captcha entered by the user in the dialog or "false" if the captcha was not entered

    PHP example:

    <?php $xhe_host = "127.0.0.1:7119";
     
    //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> app->".basename(__FILE__)."</font> <hr>";
     
    $PHP_Use_Trought_Shell = false;
     
    //1
    echo "1.Go to the image polygon:";
    echo $browser->navigate("http://www.humanemulator.net/poligon/image.html")."<br>";
     
    //2
    echo "2.Let's show the 2nd picture as a captcha:";
    echo $app->dlg_captcha_from_image_number(2)."<br>";
     
    //3
    echo "3.Let's show the 2nd image as a captcha in a 0 frame:";
    echo $app->dlg_captcha_from_image_number(2,0)."<br>";
     
    //4
    echo "4.Let's show a nonexistent picture as a captcha:";
    if(!$app->dlg_captcha_from_image_number(100500))
      echo "no such picture";
     
    //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:7011"
    from xweb_human_emulator import *
     
    # Start
    echo("<hr> <font color = blue> app.xxxxxxxxx </font> <hr>")
     
    # 1
    echo("1.Go to image polygon:")
    echo(browser.navigate("http://www.humanemulator.net/poligon/image.html"), "<br>")
    sleep(3)
    # 2
    echo("2.Let's show the 2nd picture as a captcha:")
    echo(app.dlg_captcha_from_image_number(2), "<br>")
     
    # 3
    echo("3.Show 2 image as captcha in frame 0:")
    echo(app.dlg_captcha_from_image_number(2,0), "<br>")
     
    # 4
    echo("4.Show nonexistent image as captcha:")
    if not app.dlg_captcha_from_image_number(100500):
       echo("no such picture")
     
    # 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> app.dlg_captcha_from_image_number </font> <hr>");
     
    //1 step
    echo("1.Go to the images polygon:" + browser.navigate("www.humanemulator.net/poligon/image.html", false, false) + " n");
     
    //step 2
    echo("2.Let's show the 2nd picture as a captcha:" + app.dlg_captcha_from_image_number(2) + " n");
     
    //step 3
    echo("3.Let's show the 2nd picture as a captcha:" + app.dlg_captcha_from_image_number(2, "0") + " n");
     
    //step 4
    echo("4.Let's show the 2nd picture as a captcha:" + app.dlg_captcha_from_image_number(100500));
     
    //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 = echo = require("../../../Templates JS/xweb_human_emulator.js");
     
    //Start
    echo("<hr> <font color = blue> app.dlg_captcha_from_image_number </font> <hr>");
     
    //1 step
    echo("1.Go to the image polygon:");
    echo(browser.navigate("http://www.humanemulator.net/poligon/image.html") + "<br>");
     
    //step 2
    echo("2.Let's show the 2nd picture as a captcha:");
    echo(app.dlg_captcha_from_image_number(2) + "<br>");
     
    //step 3
    echo("3.Let's show the 2nd picture as a captcha in a 0 frame:");
    echo(app.dlg_captcha_from_image_number(2,0) + "<br>");
     
    //step 4
    echo("4.Let's show a non-existent figure as a captcha:");
    if(!app.dlg_captcha_from_image_number(100500))
      echo("there is no such picture");
     
    //end
    echo("<hr> <br>");
     
    //Quit
    app.quit();
  • en/objects/app/captcha_dlg/dlg_captcha_from_image_number.txt · Last modified: 2026/08/05 22:31 (external edit)