kroe761
10 years agoContributor
Solved
Can't call functions from other files more than once when returning data- HELP! (Jscript web testing)
I have been running into this problem off and on, but today it became a full on blocker. Everytime I try to call a function from another file AND I return an object into a variable, I get the error "Object doesn't support this property or method" . This is driving me INSANE. I am defining each of the buttions , links, etc that I use in my testing in mapping files and then call those functions and return the object when I need to use that object. But, it's not working. I have tried USEUNIT and Runner.CallMethod, they both error. If I don't return anything into a variable in my test file, then it works with no problems, but when I return an object it craps out. I have been back and forth with SmartBear tech support for the past few weeks and all I hear is "R&D is looking into this." They told me to use var before a variable and that would fix it, but it didn't.
I have attached a sample project. Simply run the project or the project suite and you'll see what I'm talking about ANY help you can provide would be extremely gratifying. Thanks so much!
I have attached a sample project. Simply run the project or the project suite and you'll see what I'm talking about ANY help you can provide would be extremely gratifying. Thanks so much!
- The solution is just as John Smith/SmartBear support said.
I was able to run your project successfully simply by adding "var" before each of your variable declarations. Also not good practice to define your local variable with the same name as the function you are calling. Essentially you were redefining each function as a global variable, and when your second run came around you were trying to call that variable ex(blogLink()) as a function.
Reference: http://stackoverflow.com/questions/1470488/what-is-the-function-of-the-var-keyword-and-when-to-use-it-or-omit-it
See attached revised project.