lib/calabash-android/operations.rb in calabash-android-0.0.15 vs lib/calabash-android/operations.rb in calabash-android-0.0.16
- old
+ new
@@ -76,11 +76,11 @@
raise e
end
end
def query(uiquery, *args)
- raise "Currently only queries are only supported for webviews" unless uiquery.start_with? "webView"
+ raise "Currently queries are only supported for webviews" unless uiquery.start_with? "webView"
uiquery.slice!(0, "webView".length)
if uiquery =~ /(css|xpath):\s*(.*)/
r = performAction("query", $1, $2)
JSON.parse(r["message"])
@@ -167,10 +167,18 @@
query(q).map {|e| e['html']}
end
def set_text(uiquery, txt)
- ni
+ raise "Currently queries are only supported for webviews" unless uiquery.start_with? "webView"
+
+ uiquery.slice!(0, "webView".length)
+ if uiquery =~ /(css|xpath):\s*(.*)/
+ r = performAction("set_text", $1, $2, txt)
+ JSON.parse(r["message"])
+ else
+ raise "Invalid query #{uiquery}"
+ end
end
def swipe(dir,options={})
ni