You can try customDirectCall(String method, Object[] args)
to call your custom selenium methods directly and pass in the xpath your code generated. On Thu, May 28, 2009 at 12:53 PM, Harihara Vinayakaram <[email protected]>wrote: > Hi Jian > The problem is that I do not want xforms:inp...@id='inp1'][1] . This does > not work > > What I want is something like //xforms:repe...@id="xyz"] and have a set > of parameters to the custom Selenium function which then finds the object > (within the repeater )and does the operaton. Mozilla implements these as XBL > objects and so they are not visible in the DOM. > > One way I have been doing so far is call the customUi with these > additional paramters since that is how this works in Selenium . would like > to see if there is a better way that exists > > Regards > Hari > > > On Thu, May 28, 2009 at 7:59 PM, Jian Fang <[email protected]>wrote: > >> Seems you request subgroups inside a List. In your case, you have only two >> element in a subgroup, thus, you can use odd and even indexes >> to differentiate them. For example, you define, >> >> List(uid:"repeater1", clocator:[tag:"repeat", id: "repeater1"], >> namespace:"xforms"){ >> Input(uid: "odd", clocator: [id: "inp1"]) >> Input(uid: "even", clocator: [id: "inp2"]) >> } >> >> Then the mapping will be >> >> repeater[1] --> Input (inp1) --> xforms:inp...@id='inp1'][1] >> repeater[2] --> Input( inp2) --> xforms:inp...@id='inp2'][1] >> repeater[3] --> Input (inp1) --> xforms:inp...@id='inp1'][2] >> repeater[4] --> Input (inp2) --> xforms:inp...@id='inp2'][2] >> ...... >> >> Although Tellurium Core does not support this yet, you can easily >> implement your own List type >> to overwrite the default List xpath generation logic based on the above >> example, you need to >> overload the following method in the List object, >> >> String getListLocator(int index) >> >> I will create an issue to support different uid schema such as "odd", >> "even" in List and Table, >> but not sure I have time to do that now since I am busy with other tasks. >> Maybe this is a good >> practice for you to write custom Tellurium objects. >> >> Thanks, >> >> Jian >> >> >> On Thu, May 28, 2009 at 9:22 AM, Harihara Vinayakaram >> <[email protected]>wrote: >> >>> Hi >>> Reviving this thread again . Most of the customUi calls work by >>> passing the id from the UI and generate the xpath. So the following works >>> ui.Container(uid:"switch1", clocator: [id:"switch1", tag:"switch"], >>> namespace:"xforms",group:"true") { >>> ui.Container(uid:"case1",clocator:[id:"case-1", >>> tag:"case"],namespace:"xforms") >>> } >>> since the xpath is of form >>> xforms:swit...@id='swaitch1']//xforms:ca...@id="case1"] >>> >>> But in the case of xforms repeat which means that a homogenous set of >>> elements can be repeated >>> <xforms:repeat id="repeater1"/> >>> <xforms:input ref="inp1" /> >>> <xforms:input ref="inp2" /> >>> </xforms:repeat> >>> >>> means a row containing 2 fields can be repeated any number of times. an >>> xpath like this DOES NOT WORK >>> >>> //xforms:repe...@id='repeater1']/xforms:inp...@id='inp1'] >>> >>> Locating inp1 within the repeater1 is part of the custom selenium code >>> . So I am looking for a way to change the xpath generated >>> >>> >>> Regards >>> Hari >>> >>> >>> >>> On Tue, May 19, 2009 at 6:54 PM, Jian Fang <[email protected]>wrote: >>> >>>> I am not very clear about what the following xform does, >>>> >>>> <xforms:repeat id="repeater1"/> >>>> <xforms:input id="inp1" /> >>>> <xforms:input id="inp2" /> >>>> </xforms:repeat> >>>> >>>> Will the inp1 and inp2 be repeated for a given times? Do you need to >>>> specify the times? or >>>> have to check in Runtime? >>>> >>>> Looks like a list, instead of a table. For example >>>> >>>> List(uid: "repeater1", clocator: [tag: "repeat"], namespace: "xforms"){ >>>> InputBox(uid: "all", clocator: [tag: "input"], namespace: "xforms") >>>> } >>>> >>>> Another way is to implement xforms as Tellurium widgets >>>> so that you can handle them differently from a regular Tellurium object. >>>> >>>> >>>> Thanks, >>>> >>>> Jian >>>> >>>> >>>> On Mon, May 18, 2009 at 11:26 PM, Harihara Vinayakaram < >>>> [email protected]> wrote: >>>> >>>>> Hi Jian >>>>> I am exploring the possibility of adding support for xforms:repeat >>>>> in Tellurium . This is very similar to a table except for accessing the >>>>> element within it i.e >>>>> >>>>> <xforms:repeat id="repeater1"/> >>>>> <xforms:input id="inp1" /> >>>>> <xforms:input id="inp2" /> >>>>> </xforms:repeat> >>>>> >>>>> xforms:repeater[1]/xforms:inp...@id="inp1" ] DOES NOT WORK. >>>>> >>>>> and the Selenium extension code for accessing this looks like the one >>>>> below. How do I implement this as a List / table equivalent in Tellurium . >>>>> Let me know >>>>> >>>>> Regards >>>>> Hari >>>>> >>>>> Selenium.prototype.getRInputRefValue = function(locator, paramarray) { >>>>> var tagToCheck="xf:input"; >>>>> var attrToCheck = "ref"; >>>>> /* >>>>> There should be a better way to pass parameters from the java code >>>>> instead of the ugly comma separated values >>>>> */ >>>>> var arr = paramarray.split(","); >>>>> var inpRef=""; >>>>> >>>>> if (arr.length == 2) { >>>>> inpRef = arr[0]; >>>>> index = arr[1]; >>>>> } else { >>>>> return; >>>>> } >>>>> >>>>> var repeatElement = this.page().findElement(locator); >>>>> var content = repeatElement.anonymousRepeatContent; >>>>> >>>>> var curRow = content.childNodes[index]; >>>>> var nodes = curRow.childNodes; >>>>> /* >>>>> There should also be a better way to get the elements from a >>>>> descendant >>>>> rather than using this . But all the rest use the document element >>>>> */ >>>>> for (var i=0; i< nodes.length; i++) { >>>>> var tag = nodes[i].tagName; >>>>> if(tag) { >>>>> var attrValue = nodes[i].getAttribute(attrToCheck); >>>>> if (attrValue ) { >>>>> if (attrValue == inpRef && tag == tagToCheck) { >>>>> var curValue = nodes[i].getCurrentValue(); >>>>> return curValue; >>>>> } >>>>> } >>>>> } >>>>> } >>>>> return ""; >>>>> }; >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tellurium-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/tellurium-users?hl=en -~----------~----~----~----~------~----~------~--~---
