Please help!!! I am trying to add some performtaskwithpathargumentstimeout
functions to my ios UI automation javascript. Specifically I am submitting a form within the app and subsequently want to check that it has been submitted successfully. However I am having problems.
I want to do several things. The ideal was to do a curl request to a url, and then search the stdout body that comes back to ensure that several keywords were there. However, instruments keeps crashing when I try and use any indexOf or .search
functions on the result.stdout
...
I thought another option would be to output the html to a file, and then search that file by writing a command line application which will search for the keyword passed as an argument. However, when I try and output the file to a directory using the following-
var target = UIATarget.localTarget();
var host = target.host();
result = target.host().performTaskWithPathArgumentsTimeout("usr/bin/curl", ["-o /Users/andrewweaver/Documents/output.html", "http://www.google.co.uk"], 30);
UIALogger.logDebug("exitCode: " + result.exitCode);
UIALogger.logDebug("stdout: " + result.stdout);
UIALogger.logDebug("stderr: " + result.stderr);
I get the following error-
Warning: Failed to create the file /Users/me/Documents/output.html: \nWarning: No such file or directory
This directory DOES exist, and has permissions for anyone to read & write to it.... also, if I create the .html file in that directory the same thing happens. If I run the same command from terminal it works fine...
I also wanted to do a write out of the http code...
result = target.host().performTaskWithPathArgumentsTimeout("usr/bin/curl", ["--write-out %{http_code}", "http://www.google.co.uk"], 30);
But again, that is failing....
curl: option --write-out %{http_code}: is unknown
I'm not sure what I'm doing wrong....
Any help would be much appreciated : - )