The best place to ask programming/development questions, imo. UPDATE: stackoverflow is the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but a great reference for finding answers.

My Music (Nickleus)


sahi - how to click a span inside a table and match table id using regex

i have an html page rendered by richfaces which made things a little problematic for my sahi script test:

* even though the rich:dataTable had a hardcoded id:
<rich:dataTable id="providerListTA" ...

when the page gets rendered by richfaces, the id looks like this in the rendered html code:

* the table is rendered inside a rich:modalPanel and contains a list of providers to select. inside that table there's a row with a link in the first column that i want to click on
Provider X

the problem is that behind the modalpanel there's a list of price agreements which also contains "Provider X", so the following code doesn't work:

specifying the element number also doesn't work because it will change from user to user, depending on what's in the price agreement list:

so i read the sahi api documentation and found out how to use the DOM relation marker called "_in", together with a regexp that matched only the hardcoded id in the xhtml/jsf code, leaving out the richfaces-appended texts, i.e. "j_id1045:" and ":tb":

_click(_span($transporter_name, _in(_table(/.*providerListTA.*/))));

Provider X is passed into the sahi script method as $transporter_name and the regex part of the code is this:

which means to match an id containing providerListTA with any characters in front or behind it.

No comments:

Post a Comment