Within a script written in JavaScript for the UI Automation instrument, how do I import another JavaScript file?
Within a script in the UI Automation instrument, how do I import another script?
Asked Answered
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.
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 '(null –
Gony
@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.