samedi 25 avril 2015

How to use regular expression in sahi script?

I am using sahi for automate the website, when I record the actions from the sahi recorder then it record click action of a button(actually "span") as _click(_span("Done[4]"));
but when I play the recorded script then it got failed on that line as it does not found the "Done[4]".
To solve this I just tried Regular expression to click on the _span("Done[4]") but no luck.

HTML Source structure :(this get displayed in popup [ui-dialog,ui-widget])

<div class="dashboardDlgButtonPanel">
<div id="addWidgetDone_wrapper" class="input_button  ">
    <div id="addWidgetDone" class="form_input_button">
        <div class="buttonwrapper">
            <a style="width: 49px; height: 41px; display: block;" id="addWidgetDone_Link" class="PrimaryButton" href="#" s1ignore="true" data-role="button" title="">
                <span>Done</span>
            </a>
        </div>
    </div>
</div>
<div id="addWidgetCancel_wrapper" class="input_button  tertiaryButton">
    <div id="addWidgetCancel">
        <div class="buttonwrapper">
            <a id="addWidgetCancel_Link" class="link" href="#" s1ignore="true" title="">Cancel</a>
        </div>
    </div>  
</div>
</div>

I tried followings one by one:

_click(_span(/Done.*/));
_click(_span(/Done\\[[0-9]\\]/));
_click(_span(/Done\[[0-9]\]/));
_click(_span(/Done/i));
_click(_span("/Done/"));
_click(_span(new Reg Exp("Done\\[[0-9]\\]")));
_click(_span(/Done.*/,_near(_div("addWidgetDone_wrapper[1]"))));
_click(_span(/Done.*/,_near(_div(/addWidgetDone_wrapper\\[[0-9]\\]/))));
_click(_span(/Done.*/,_near(_div(/addWidgetDone_wrapper.*/))));
_click(_span(/Done.*/,_in(_div("addWidgetDone_wrapper[1]"))));
_click(_span(/Done.*/,_in(_div(/addWidgetDone_wrapper/))));
_click(_span(/Done.*/,_in(_div(/addWidgetDone_wrapper.*/))));

and many more other combination but none of them working.

Ref Link :sahi-link-1 , sahi-link-2

Can any one please tell me what wrong I am doing?

Note : In recorded action "Done[4]" the numeric part is getting changed every time.

Aucun commentaire:

Enregistrer un commentaire