Announcement

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

    Selenium - menu items issue

    Hi SmartClient team,
    We are using Selenium testing for SmartClient based application. We downloaded user extensions and installed as expected. My problem is with the menu component. What we do is (after recording the test using Selenium IDE (with smart client extensions)) (real life example):

    - expand menu items (attached expand.jpg)
    - go to selenium IDE and click "Find" on element item we are interested in (attached find.jpg) (as you can see it shows the proper item (we want to find the element with label "Search User Roles" (as we can see in the locator))
    - next go to Selenium IDE and execute the above click command: the issue is that the item which is clicked is the item which is before "Search User Roles" ("Create User" in our case) i.e

    It works as above in all "popup" menus - if the first element is clicked it works fine but for next items it will always click the previous item. Seems like some problem with indexing? Can you please give me any pointers regarding my problem? Any other folks up here on the forum had a similar issue or any ideas or a workaround?
    Attached Files

    #2
    I went deeper into the issue and it seems that the problem lied in Y coordinate calculation (or usage?) (doClick in user extensions). The function "Element.getElementRect(element)" returned expected coordinates, but the problem was that after calling "this.browserbot.triggerMouseEvent(element, "mousedown", true, clientX, clientY);" it appeared that Y coordinate caused the issue that the previous cell was clicked - my guessing is that it happened because of the border, which I had between table cells - it was enough to move the cursor down and after that the proper element was clicked.
    So - in "Selenium.prototype.doClick = function(locator, eventParams)" (user extensions) I changed "var clientY = rect[1];" to something like "var clientY = rect[1] + (rect[3]/2);" (to click in the middle of the cell) and seems that it solved my problem. Any comments regarding above? I'm using Firefox 3.6.3.

    Comment


      #3
      This was actually changed today (to use the center of the target element rather than the top/left edge)
      - try the next nightly build and let us know if it's behaving as you'd expect

      Thanks
      Isomorphic Software

      Comment


        #4
        Hi,
        I downloaded the latest build from http://www.smartclient.com/smartgwt/builds/latest/ but it looks for me that the behavior is still the same - I also don't see any change related to location of the click in extensions (but maybe you provided it somewhere in underlying components(?)).
        Thnx,
        Marcin

        Comment


          #5
          Originally posted by marcinmarcin
          Hi SmartClient team,
          It works as above in all "popup" menus - if the first element is clicked it works fine but for next items it will always click the previous item. (...) Any other folks up here on the forum had a similar issue or any ideas or a workaround?
          As a workaround, I used to address the menuitems by their index (row number), incremented by one. For example, the fourth option would be "row[3]" (indexed from 0), so I address it like this:

          scLocator=//Menu[ID="menuView_menusettings_customizing"]/body/row[4]/col[1]

          But this is nothing - the real problem begins if you want to click the _last_ item of a menu. Increasing the index won't work, because there is no further menu item whose position would be erroneously calculated...

          I haven't figured out any workaround yet. As for ideas, I tried using xpath locators but firing the "click" event on "td" element, in which the menu item is rendered, seems to violate some security restrictions in javascript:

          [error] Unexpected Exception: QueryInterface -> function QueryInterface() { [native code] }, message -> Security Manager vetoed action, result -> 2153185319, name -> NS_ERROR_XPC_SECURITY_MANAGER_VETO, filename -> http://localhost:8080/****/sc/modules/ISC_Core.js, lineNumber -> 1791, columnNumber -> 0, location -> JS frame :: http://localhost:8080/*****/sc/modules/ISC_Core.js :: isc_c_Element__getOffsetFromElement :: line 1791, inner -> null, data -> null, initialize -> function initialize() { [native code] }

          Marcin, how did you cope with that situation?

          Comment

          Working...
          X