aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2013-07-08 17:12:05 -0700
committerTony Wickham <twickham@google.com>2013-07-08 17:12:05 -0700
commit9f554eb6d4d25a0a31be3ab88fb715fc3cee4027 (patch)
tree695d2504fc218497c45573031ec54ac1bd8a5b23
parentb27621ff6e9da190454da80b93bc1a7544904909 (diff)
downloaddroiddriver-9f554eb6d4d25a0a31be3ab88fb715fc3cee4027.tar.gz
Added containsAttr() to XPaths.
Change-Id: I8ada6883107d7dbceaf0e9391a683ff498924b36
-rw-r--r--src/com/google/android/droiddriver/finders/XPaths.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/com/google/android/droiddriver/finders/XPaths.java b/src/com/google/android/droiddriver/finders/XPaths.java
index e9d4837..d1be75f 100644
--- a/src/com/google/android/droiddriver/finders/XPaths.java
+++ b/src/com/google/android/droiddriver/finders/XPaths.java
@@ -81,6 +81,11 @@ public class XPaths {
return String.format("[@%s='%s']", attribute.getName(), value);
}
+ /** @return XPath predicate (with enclosing []) for attribute containing value */
+ public static String containsAttr(Attribute attribute, String containedValue) {
+ return String.format("[contains(@%s, '%s')]", attribute.getName(), containedValue);
+ }
+
/** Shorthand for {@link #attr}{@code (Attribute.TEXT, value)} */
public static String text(String value) {
return attr(Attribute.TEXT, value);