5
5
import io .appium .java_client .AppiumDriver ;
6
6
import io .appium .java_client .FindsByIosUIAutomation ;
7
7
import io .appium .java_client .MobileElement ;
8
+ import io .appium .java_client .ios .internal .JsonToIOSElementConverter ;
8
9
import io .appium .java_client .remote .MobilePlatform ;
9
10
10
11
import org .openqa .selenium .Capabilities ;
@@ -21,55 +22,30 @@ public class IOSDriver extends AppiumDriver implements IOSDeviceActionShortcuts,
21
22
public IOSDriver (URL remoteAddress , Capabilities desiredCapabilities ) {
22
23
super (remoteAddress , substituteMobilePlatform (desiredCapabilities ,
23
24
IOS_PLATFORM ));
25
+ this .setElementConverter (new JsonToIOSElementConverter (this ));
24
26
}
25
27
26
28
/**
27
29
* Scroll to the element whose 'text' attribute contains the input text.
28
30
* This scrolling happens within the first UIATableView on the UI. Use the additional 'context' param to specify a different scrollView.
29
31
* @param text input text contained in text attribute
30
32
*/
31
- @ Override
32
- public void scrollTo (String text ) {
33
- scrollTo ( text , ( MobileElement ) findElementByClassName ("UIATableView" ));
34
- }
33
+ @ Override
34
+ public MobileElement scrollTo (String text ) {
35
+ return (( MobileElement ) findElementByClassName ("UIATableView" )). scrollTo ( text );
36
+ }
35
37
36
- /**
38
+ /**
37
39
* Scroll to the element whose 'text' attribute is equal to the input text.
38
40
* This scrolling happens within the first UIATableView on the UI. Use the additional 'context' param to specify a different scrollView.
39
41
* @param text input text to match
40
42
*/
41
- @ Override
42
- public void scrollToExact (String text ) {
43
- scrollToExact (text , (MobileElement ) findElementByClassName ("UIATableView" ));
44
- }
45
-
46
- /**
47
- * Scroll to the element whose 'text' attribute contains the input text.
48
- * @param text input text contained in text attribute
49
- * @param context container element to scroll within
50
- */
51
- public void scrollTo (String text , MobileElement context ) {
52
- context .findElementByIosUIAutomation (".scrollToElementWithPredicate(\" name CONTAINS '" + text + "'\" )" );
53
- }
54
-
55
- /**
56
- * Scroll to the element whose 'text' attribute is equal to the input text.
57
- * @param text input text to match
58
- * @param context container element to scroll within
59
- */
60
- public void scrollToExact (String text , MobileElement context ) {
61
- context .findElementByIosUIAutomation (".scrollToElementWithName(\" " + text + "\" )" );
62
- }
63
-
64
- /**
65
- * Scroll to the given element.
66
- * This scrolling happens within the first UIATableView on the UI. Use the ScrollToExactWithinContext() method to specify a different scrollView.
67
- */
68
- public void scrollTo (WebElement el ) {
69
- scrollToExact (el .getText ());
70
- }
43
+ @ Override
44
+ public MobileElement scrollToExact (String text ) {
45
+ return ((MobileElement ) findElementByClassName ("UIATableView" )).scrollToExact (text );
46
+ }
71
47
72
- /**
48
+ /**
73
49
* @see IOSDeviceActionShortcuts#hideKeyboard(String, String)
74
50
*/
75
51
@ Override
0 commit comments