Announcement

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

    Selenium: Missing support for scLocators in user-extensions-ide.js

    I am using the user-extensions.js and user-extensions-ide.js from the nightly 6.1d build from yesterday. The application is running in SmartGWT 4.1.

    When you right click on elements during Selenium IDE recording sessions you can add commands via "Show All Available Commands". All of them except for assertTable, verifyTable, waitForTable and storeTable don't support scLocators. Instead the normal Selenium xpath selectors are shown such as "//div[@id='']" or "id=isc_5Stable.1.0".

    Without the commands asserts can not be created efficiently as you would have to click on all elements to get scLocators and then edit the commands to verifyText and verifyValue.

    SmartClientWebDriver currently supports verifyText and verifyValue but since the generated selectors are not scLocators the methods are incompatible with the generated selectors.

    Table commands are as I have said the only commands which support scLocators at the moment. Sadly there is no SmartClientWebDriver method equivalent so all shown availabe commands in the Selenium IDE for verifying contents are useless at the moment if you want to test with SmartClientWebDriver after transforming the Testcase with the SeleneseRunner.

    The issue about a missing verifyTable method in SmartClientWebDriver is already reported in this post.

    #2
    I've tried implementing them myself and wrote the following command:

    Code:
    CommandBuilders.add('accessor', function(window) {
        var autWindow = window;
        if (autWindow.wrappedJSObject) {
            autWindow = autWindow.wrappedJSObject;
        }
        var result = { accessor: "text", disabled: true };
        if(hasSC(autWindow)) {
            var element = this.getRecorder(window).clickedElement;
            var scLocator = findScLocator(element,autWindow);
    
            result.value = element.textContent;
            result.target = scLocator;
            result.disabled = false;
            return result;
        }
    
        return result;
    });
    This works but there is no easy solution for the accessor value.

    The problem is that SmartGTW's getValue doesn't return the same values as Selenium's.

    Some examples for getValue with scLocators:
    • getValue scLocator=//ListGrid[ID="NewFutureWorkOrdersGrid"]/body/row[signature=1-1-2-0||2]/col[fieldName=signature||5] returns 1-1-2-0 instead of 1-1-2-<span style="color:lightgrey">0</span>
    • getValue scLocator=//ListGrid[ID="NewFutureWorkOrdersGrid"]/body/row[signature=1-1-2-0||2]/col[fieldName=PREPARED||5] returns PREPARED instead of nothing (the column contains only an image)
    Last edited by stefan_berger; 15 Jun 2016, 12:58.

    Comment


      #3
      Using the user extensions files from a different release is an unsupported configuration. You need to use the files from the release you're running, SmartGWT 4.1p in your case, as they're matched to the Framework from that release. That being said, we do see the issue you mention with "show all commands" showing several commands without scLocators and we're looking into it.

      The reason this hasn't been on our radar is that most users write tests by interacting directly with the page as commands are auto-recorded, generating verify<...>() commands by clicking on an element and then manually changing the command name from "click" to the appropriate verify<...>() command.

      We'll update this thread if a fix is made - in the mean time, the method described above of generating verify<...>() commands should work.

      Comment


        #4
        We've made improvements to the commands provided by the context menu in Selenium IDE when using our extensions. They should now use our locators, and follow our semantics for getText() and getValue(). Note that for getText(), we fall back to the native Selenium getValue() if there otherwise would be no value present, while our getValue() doesn't use any of the native Selenium logic but instead returns our Framework's notion of the element's value - typically the same as if you had called AutoTest.getValue() on the locator.

        You'll need to update to use a more recent release to pick up the changes - we're only going to apply them to SGWT 5.1p/SC 10.1p and newer. They will be in the nightly builds dated 2016-06-16 and newer. (Your approach of using mixed files from different releases may work, but it's not supported so we won't be able to address any issues that result from it.)
        Last edited by Isomorphic; 15 Jun 2016, 08:50.

        Comment

        Working...
        X