File tree Expand file tree Collapse file tree 3 files changed +24
-15
lines changed
main/java/io/appium/java_client
test/java/io/appium/java_client/android Expand file tree Collapse file tree 3 files changed +24
-15
lines changed Original file line number Diff line number Diff line change 16
16
17
17
package io .appium .java_client ;
18
18
19
+ import com .google .common .collect .ImmutableMap ;
20
+
19
21
import org .openqa .selenium .By ;
20
22
import org .openqa .selenium .Dimension ;
21
23
import org .openqa .selenium .Point ;
@@ -106,4 +108,16 @@ public List<MobileElement> findElementsByXPath(String using) {
106
108
@ Override public List <MobileElement > findElementsByAccessibilityId (String using ) {
107
109
return super .findElementsByAccessibilityId (using );
108
110
}
111
+
112
+ /**
113
+ * This method sets the new value of the attribute "value".
114
+ *
115
+ * @param value is the new value which should be set
116
+ */
117
+ @ SuppressWarnings ({"rawtypes" , "unchecked" })
118
+ public void setValue (String value ) {
119
+ ImmutableMap .Builder builder = ImmutableMap .builder ();
120
+ builder .put ("id" , id ).put ("value" , value );
121
+ execute (MobileCommand .SET_VALUE , builder .build ());
122
+ }
109
123
}
Original file line number Diff line number Diff line change 16
16
17
17
package io .appium .java_client .ios ;
18
18
19
- import com .google .common .collect .ImmutableMap ;
20
-
21
19
import io .appium .java_client .FindsByIosUIAutomation ;
22
- import io .appium .java_client .MobileCommand ;
23
20
import io .appium .java_client .MobileElement ;
24
21
import org .openqa .selenium .WebDriverException ;
25
22
@@ -44,16 +41,4 @@ public class IOSElement extends MobileElement
44
41
throws WebDriverException {
45
42
return findElements ("-ios uiautomation" , using );
46
43
}
47
-
48
- /**
49
- * This method sets the new value of the attribute "value".
50
- *
51
- * @param value is the new value which should be set
52
- */
53
- @ SuppressWarnings ({"rawtypes" , "unchecked" })
54
- public void setValue (String value ) {
55
- ImmutableMap .Builder builder = ImmutableMap .builder ();
56
- builder .put ("id" , id ).put ("value" , value );
57
- execute (MobileCommand .SET_VALUE , builder .build ());
58
- }
59
44
}
Original file line number Diff line number Diff line change @@ -74,4 +74,14 @@ public class AndroidElementTest extends BaseAndroidTest {
74
74
+ "new UiSelector().text(\" Radio Group\" ));" ));
75
75
assertNotNull (radioGroup .getLocation ());
76
76
}
77
+
78
+ @ Test public void setValueTest () {
79
+ String value = "new value" ;
80
+
81
+ driver .startActivity ("io.appium.android.apis" , ".view.Controls1" );
82
+ AndroidElement editElement = driver
83
+ .findElementByAndroidUIAutomator ("resourceId(\" io.appium.android.apis:id/edit\" )" );
84
+ editElement .setValue (value );
85
+ assertEquals (value , editElement .getText ());
86
+ }
77
87
}
You can’t perform that action at this time.
0 commit comments