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 1616
1717package io .appium .java_client ;
1818
19+ import com .google .common .collect .ImmutableMap ;
20+
1921import org .openqa .selenium .By ;
2022import org .openqa .selenium .Dimension ;
2123import org .openqa .selenium .Point ;
@@ -106,4 +108,16 @@ public List<MobileElement> findElementsByXPath(String using) {
106108 @ Override public List <MobileElement > findElementsByAccessibilityId (String using ) {
107109 return super .findElementsByAccessibilityId (using );
108110 }
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+ }
109123}
Original file line number Diff line number Diff line change 1616
1717package io .appium .java_client .ios ;
1818
19- import com .google .common .collect .ImmutableMap ;
20-
2119import io .appium .java_client .FindsByIosUIAutomation ;
22- import io .appium .java_client .MobileCommand ;
2320import io .appium .java_client .MobileElement ;
2421import org .openqa .selenium .WebDriverException ;
2522
@@ -44,16 +41,4 @@ public class IOSElement extends MobileElement
4441 throws WebDriverException {
4542 return findElements ("-ios uiautomation" , using );
4643 }
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- }
5944}
Original file line number Diff line number Diff line change @@ -74,4 +74,14 @@ public class AndroidElementTest extends BaseAndroidTest {
7474 + "new UiSelector().text(\" Radio Group\" ));" ));
7575 assertNotNull (radioGroup .getLocation ());
7676 }
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+ }
7787}
You can’t perform that action at this time.
0 commit comments