3

Is it possible to call a webservice from UIAutomation?

on this webpage http://www.geonames.org/export/ajax-postalcode-autocomplete.html it is possible to type in country and postal code, and get following reponse

http://api.geonames.org/postalCodeLookupJSON?postalcode=2830&country=DK&username=demo

 {"postalcodes":[{"postalcode":"2830","countryCode":"DK","lng":12.4666667,"placeName":"Virum","lat":55.8}]}

Im fairly new to this, is there a way i can call the service with arguments or build the url myself and call that and get a response as JSON into UIAutomation?

Uooo
  • 6,204
  • 8
  • 36
  • 63
user2964827
  • 59
  • 1
  • 3

1 Answers1

0

You can do it like this:

var result = target.host().performTaskWithPathArgumentsTimeout("/usr/bin/curl", ["http://yoururl"], 30);
var json = JSON.parse(result.stdout)
Morten Holmgaard
  • 7,484
  • 8
  • 63
  • 85