Forum Discussion

detached31's avatar
detached31
Occasional Contributor
4 months ago

Difference in JavaScript support with TC 15.61

I have some code which retrieves a JavaScript variable (a boolean value) from a Web page, in a test script (JScript).

var oPerfs = Sys.Browser("*").WaitPage("*",10000).
   contentDocument.script.
   com.sap.powerdesigner.web.galilei.features.performance;

This worked (always) with TestExecute 15.55.53.11 with Chrome 121.0.6167. (and we then use the oPerfs variable to set the JavaScript variable to true, and activate some performance counters in the page, that we later retrieve from some JS variables in the ...web.galilei.features namespace).

This fails repeatedly with TestExecute 15.61.1.11 with the same Chrome: 'sap' is null or not an object.

All the Chrome are using the 15.0.4 Smartbear Test Extension.

(as a side note, it fails with any version of TE with Chrome Beta 122)

Should it work?

5 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Are you able to call *feature.performance in Chrome DevTools, and does it work?

  • detached31's avatar
    detached31
    Occasional Contributor

    Yes, it works in DevTools. I see an object, with sub-objects: DebugCounter, Measure, Performance (again), logger, root...
    The following test script line does "oPerfs.root.active = true;". And I can see this boolean ...performance.root.active in Chrome DevTools. (also in Firefox 122, or MS Edge 121)

  • detached31's avatar
    detached31
    Occasional Contributor

    I have submitted a case on February, 9, which is still on-going.

    After some further tests, the behavior change happened between TC 15.57, and 15.58.

    I have submitted a simple reproduction case: a HTML page with some JavaScript elements:

        <script>
    var globalVar = "global var";
    var obj = { "a": 20, "b" : function() { return "obj.b return"; } };
    var editedByEval = 10;
    function getSomeValue() { return "get some value"; }
    function setEditedByEval(val) { if (val != null) { editedByEval = val; } return editedByEval; }
        </script>

    I'm loading the page with Chrome. And there is a JavaScript TestComplete script which accesses these elements (with value check, and exception processing removed):

    var page = Sys.Browser("*").WaitPage("*");
    var g = page.contentDocument.Script.globalVar;
    g = page.contentDocument.Script.obj.a;
    g = page.contentDocument.Script.getSomeValue();
    g = page.contentDocument.Script.obj.b();
    page.contentDocument.Script.eval("setEditedByEval(30);");

    Starting with 15.58, all these elements under .Script, are undefined (which might trigger an exception when accessing a sub-object, e.g. ".Script.obj.a")

    • rraghvani's avatar
      rraghvani
      Champion Level 3

      The functionality is broken in the latest version, but works fine in v15.55.53.7