veronica_glynn
10 years agoContributor
Needs guidance to set up JavaScript within Scripts
Good morning!
I am having some difficulties in understanding the provided help document: Executing JavaScript. I need to run several JavaScript functions in order to perform much needed user actions and content verification on my tested application. However, I am not making much sense of the help document. I created my MyScriptFile.js and placed it in a Scripts folder within my Test Complete directory. Within that files are my 2 JavaScript functions. Now what do I do? :-)
The help doc tells me to enter:
res = pageObj.contentDocument.Script.functionName(param1, ..., paramN)
So I have entered:
res = Aliases.browser.pageCogneroTestGenerator.contentDocument.Script.GetIDOfRightPaneElement(0)
My questions:
1. Should this be a 'Function' or a 'Sub' routine?
2. How do I let Test Complete know where my scripts file resides?
3. Can I just continuously add JS to this files as the need arises?
4. Can you please help me write my first successful method so that I can understand what the heck I am trying to do? :-D
** The JS is created to pull object information and pass it back to a variable that I will then use in another method. The 2nd JS function will perform a user action (dbl click).
Thank you so much for your help. Please let me know if anything is unclear.
I am having some difficulties in understanding the provided help document: Executing JavaScript. I need to run several JavaScript functions in order to perform much needed user actions and content verification on my tested application. However, I am not making much sense of the help document. I created my MyScriptFile.js and placed it in a Scripts folder within my Test Complete directory. Within that files are my 2 JavaScript functions. Now what do I do? :-)
The help doc tells me to enter:
res = pageObj.contentDocument.Script.functionName(param1, ..., paramN)
So I have entered:
res = Aliases.browser.pageCogneroTestGenerator.contentDocument.Script.GetIDOfRightPaneElement(0)
My questions:
1. Should this be a 'Function' or a 'Sub' routine?
2. How do I let Test Complete know where my scripts file resides?
3. Can I just continuously add JS to this files as the need arises?
4. Can you please help me write my first successful method so that I can understand what the heck I am trying to do? :-D
** The JS is created to pull object information and pass it back to a variable that I will then use in another method. The 2nd JS function will perform a user action (dbl click).
Thank you so much for your help. Please let me know if anything is unclear.