No announcement yet.
  • Filter
  • Time
Clear All
new posts

    AutoTest.js getElement throws an exception for automated testing

    I am trying to create an extension for smartgwt using QTP extensibility and autotest.js (mentioned in one of the posts). After getting things to go as far as picking up the right locator, it blows up while trying to retrieve the element.

    This is the locator returned for showcase nav tree ("Miller Columns") node
    And here is where it blows up "baseComponent.getElementFromSplitLocator(locatorArray)" in getElement

    return baseComponent ? baseComponent.getElementFromSplitLocator(locatorArray) : null;
    This is the actual code in isc core which blows up:

    return isc.emptyString},getElementFromSplitLocator:function(_81){var _8=this.getChildFromLocatorSubstring(_81[0]);if(_8){_81.removeAt(0);
    Has anyone got any ideas? As always any help is greatly appreciated.

    Last edited by abhisec; 31 Mar 2010, 10:29.

    bump bump bump...

    anyone from isomorphic any insights?


      How did you obtain the locator "//TreeGrid[ID="isc_OID_13"]/body/row4/col0" for the ColumnTree? Here's a locator string that I obtained for a particular column / row of the Miller Column sample.




        Locator for miller column node

        Hi Sanjiv,
        I got that for the Miller Column node in the navigation tree grid on left. That is returned after i pass in the cell element for that node. Am i missing something?



          Even for miller column it returns listgrid

          This is what i get for Miller column cell, which is quite different from what sanjiv got, what am i missing? Do i have the wrong version of AutoTest.js?

          Last edited by abhisec; 1 Apr 2010, 06:27.


            Hi All
            There's been a lot of very recent work done in the AutoTest locator area- can you verify which version you're working with? I'm guessing upgrading to the latest nightly will make this work

            Isomorphic Software


              Updated to latest nightly now getting a different error

              I think the problem was with the autotest which i was using, it was from smartclient 7.1 i believe.

              Here is what i get when I am trying to use the same element which sanjiv used (Miller Column column2 row 0) and with the latest nightly build, it now blows up in

               locator.add(field + this.fallback_equalMarker + config[field]);
              Here is the function where it fails:

              createLocatorFallbackPath: function(name, config) {
                      var locator = [];
                      for (var field in config) {
                          if (field == this.fallback_valueOnlyField) {
                          } else {
                              locator.add(field + this.fallback_equalMarker + config[field]);
                      return name + this.fallback_startMarker + locator.join(this.fallback_separator) +
              Any insights?


                locator.add was the problem

                This is the locator i am getting after changing the array add to push:

                It's now blowing up on getElement for string functions on locator, fixing that now. Will keep you guys posted, thanks for the help so far



                  body._suppressEventHandling is not defined

                  I am further along where it is able to get correct locator and row num, col num for miller columns etc, but it blows up on this line

                    if (body._suppressEventHandling()) return null;
                  inside this function

                  // Override getInnerElementFromSplitLocator to handle cells in the body/frozenBody
                          getInnerElementFromSplitLocator : function (locatorArray) {
                              if (this.emptyLocatorArray(locatorArray)) return this.getHandle();
                              // expected format: "frozenBody", row[...], col[...]"
                              var body = locatorArray[0];
                              if (locatorArray.length == 3 && (body == "body" || body == "frozenBody")) {
                                  // Start with the field!
                                  var colLocator = locatorArray[2],
                                      colLocatorConfig = isc.AutoTest.parseLocatorFallbackPath(colLocator);
                                  // colLocatorConfig will have name:"col", config:{config object}
                                  // The 'getChildFromLocatorSubstring() method already checks for this but
                                  // as a sanity check verify the name of the col locator
                                  if ( != "col") {
                                      this.logWarn("Error parsing locator:" + locatorArray.join("") + 
                                          " returning ListGrid handle");
                                      return this.getHandle();
                                  var field = this.getFieldFromColLocatorConfig(colLocatorConfig.config),
                                  // If no fieldName stored, use the previous colNum instead
                                  // [we stored the colNum relative to the body in question]
                                  if (field == null) {
                                      localColNum = parseInt(colLocatorConfig.config[isc.AutoTest.fallback_valueOnlyField]);
                                      if (body == "frozenBody" && this.frozenBody == null) {
                                          body = "body";
                                      // convert to string to a pointer to the widget
                                      body = this[body];
                                  } else {
                                      localColNum = this.getLocalFieldNum(this.getFieldNum(field)); 
                                      if (this.fieldIsFrozen(field)) body = this.frozenBody;
                                      else body = this.body;
                                  // At this point we know what body it's in and what the colNum is within that
                                  // body.
                                  // Now find the row
                                  var rowLocator = locatorArray[1],
                                      rowLocatorConfig = isc.AutoTest.parseLocatorFallbackPath(rowLocator),
                                      rowNum = this.getRowNumFromLocatorConfig(rowLocatorConfig.config);
                                  if (isc.isA.Number(rowNum) && isc.isA.Number(localColNum)) {
                                      // We suppress all events on row/cols during row animation
                                      // in this case suppress the element entirely so auto-test engines
                                      // don't attempt to fire events on them.
                                      if (body._suppressEventHandling()) return null;
                                      return body.getTableElement(rowNum, localColNum);
                              return this.Super("getInnerElementFromSplitLocator", arguments);
                  again any help is appreciated.


                    What is getElement supposed to return?

                    After i get the element using the locator what is returned? Is it a reference to actual smart client widget entity on which we can call functions and simulate some of the actions programmatically? It doesn't look like i am getting a smartclient reference back.

                    Sanjiv or Isomorphic do you have any ideas or pointers? Also, how to go about getting simple click events to be fired on these widgets as event fires don't work. Do i need to use isc eventhandler?
                    Last edited by abhisec; 1 Apr 2010, 19:03.



                      anyone got any ideas about AutoTest.getElement element type? is it supposed to return smartclient component reference? if so why are this elements not responding to events?


                        AutoTest.getElement() returns the DOM element. To get the SmartClient Canvas corresponding to this element call

                        var canvas = isc.AutoTest.locateCanvasFromDOMElement(element);


                          How do we trigger events on the canvas

                          If we get the canvas, can we still fire click events on this? So for example we get the dom element for the tree node, and then add the call to get the canvas, will ISC EventHandler handleClick propagate the click event correctly?


                            You need to trigger DOM events on the DOM element itself. We already have code that does exactly this for Selenium support so if you can wait until this gets added to SVN, you can simply adopt the code pretty much as-is for QTP support. The code for Selenium support will hit SVN soon.


                              I did add dom events

                              That's exactly what i tried to do. Unfortunately it doesn't like them. So i am probably doing something wrong. I am trying to click the tree nodes in the navigation section.

                              What i have tried is creating a new event object and fireEvent. I tried click and mouseDown, mouseUp and Click sequence but none of them seemed to work.

                              Anyways, thanks for the reply, is there a way i can get my hands on the code before it hits the svn :). If not when can we expect this to hit the svn?