Within a script in the UI Automation instrument, how do I import another script?
Asked Answered
U

1

6

Within a script written in JavaScript for the UI Automation instrument, how do I import another JavaScript file?

Urethra answered 18/5, 2011 at 7:24 Comment(1)
Be more specific of what you want to do.Artima
S
7

Within UI Automation, you can add something like

#import "MySharedFunctions.js"

at the top of your script to have it pull in code from another JavaScript file. This can be used for storing common testing or other helper functions within a shared source file.

Simson answered 31/8, 2011 at 16:31 Comment(4)
Does the file have to be in the same directory? I'm trying to do this, but it keeps telling me "The #import file 'UIAutomationTest-CreateAccount.js' was not found, as required from the script '(nullGony
@ZS - Possibly. All of the times I've used this, the JavaScript files were in the same directory. I haven't experimented too much with file location.Simson
You will see the not found error if you have created a new script and have not yet saved it (i.e. exported - menu click on text area). Once you save it the error should go away.Nad
@ZS you can use ../ to move back up the file tree.Riemann

© 2022 - 2024 — McMap. All rights reserved.