Forum Discussion

han's avatar
han
Contributor
14 years ago

Calling Scripts Located on a Web Page From TestComplete Scripts for firefox

Has anyone been successful in "Calling Scripts Located on a Web Page From TestComplete Scripts" for firefox.



According to http://smartbear.com/support/viewarticle/11451/ it should be possible to call javascripts on a webpage by using:

Page(page_URL).contentDocument.Script.routine_name( [Parameter1, Parameter2, ...] )



- We are using tree model and we get it to work for IE.

11 Replies

  • Hi Håkan,



    I've reproduced your problem with passing functions as parameters. We'll investigate it as well.

    Meanwhile, you can use the following workaround - wrap the callback functions into helper functions and call them instead.

    That is, instead of passing a function declaration to the TestComplete engine:

        Item = Script.JSFunction("param1", function() {...})

    you need to create a wrapper for the callback function in the web-page script:

        JSFunctionWrapper(param1) { JSFunction(param1, function() {...})}

    and invoke this wrapper from TestComplete:

        Item = JSFunctionWrapper("param1");



    I hope this helps.