0

When using a javascipt to UIAutomation Test in Instruments, is there any chance the javascript can get it's own absolute path on my computer? Like in a shell script, we can use pwd to get its absolute path.

Joe Masilotti
  • 16,815
  • 6
  • 77
  • 87
Yating Dan
  • 11
  • 1
  • 5
  • May I know what you want to do with the absolute path? – Dattatreya Kugve Mar 22 '16 at 09:50
  • @DattatreyaKugve , According to "UI Automation JavaScript Reference for iOS", Apple has offered a interface called "performTaskWithPathArgumentsTimeout(path, args, timeout)" to execute a task, it can be used like this "host.performTaskWithPathArgumentsTimeout("/bin/echo", ["Hello World"], 5)". Here the "path" must be an absolute path, and I need javascript's absolute path. I hope instead of manually specifying it, I can get it automatically. In this way, everyone using this javascript on their own computer can just using it without altering anything. – Yating Dan Mar 22 '16 at 10:21
  • Just to understand more 'host.performTaskWithPathArgumentsTimeout' Is it a javascript function? If it is a javascript where it is deployed? On a application server? – Dattatreya Kugve Mar 22 '16 at 10:41
  • @DattatreyaKugve, Yeah, the javascript can be imported in the Instruments which is a testing tool. And the Instruments can run it. [link](https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/UIAutomation.html#//apple_ref/doc/uid/TP40004652-CH78-SW1) – Yating Dan Mar 23 '16 at 02:23
  • Ok . I don't know about inner workings of this instrument tool. But I don't think javascript can get it's absolute system path. Generally javascript gets deployed on a web server as part of a application and it will be having a absolute path with respect to the 'context-name' of the application. You can get the absolute path with respect to 'context-name' as mentioned [here](http://stackoverflow.com/questions/13261970/how-to-get-the-absolute-path-of-the-current-javascript-file-name) – Dattatreya Kugve Mar 23 '16 at 04:32

0 Answers0