18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Code Ok in evaluate expression = recursive_access on playback

Fabrice BFabrice B Members
edited September 2011 in Sahi - Open Source
Hi all,

Like the post http://sahi.co.in/forums/viewtopic.php?id=2808, i've a problem to recover and use a text string with regexp, but only when i use the playback.

On my page, i've a textarea whitch contains the text :

[list=*]
[*]"Crawl Name: 856 \n"[/*]
[/list]

I want to recover this number to re-use it in the script

In my scipt, i've
var $CrawlNameText = (_getText(_textarea(0))).match(/Crawl Name:.*\n/);
    _debug ( $CrawlNameText );
var $id = String ($CrawlNameText).match (/[0-9]+/)
    _debug ( $id );
[list=*]
[*]The "Start Sahi" console gives me the right answer[/*]
[/list]
Debug: Crawl Name: 856

Debug: 856

[list=*]
[*]When i execute this code, the playback gives me[/*]
[/list]
Debug: recursive_access
Debug: recursive_access

Thank you so

Regards

Fabrice

Comments

  • Hi Fabrice,

    Can you try using:
    var $CrawlNameText = "" + (_getText(_textarea(0))).match(/Crawl Name:.*\n/);
        _debug ( $CrawlNameText );
    var $id = "" + String ($CrawlNameText).match (/[0-9]+/)
        _debug ( $id );
    

    instead of
    var $CrawlNameText = (_getText(_textarea(0))).match(/Crawl Name:.*\n/);
        _debug ( $CrawlNameText );
    var $id = String ($CrawlNameText).match (/[0-9]+/)
        _debug ( $id );
    

    Check if this solves your issue.

    Regards
    Sumitra
  • Hi all,

    HO NO !!! it works !!

    i've tried ""+ but without spaces before and after the +

    thank you so Sumitra

    regards

    Fabrice
This discussion has been closed.