55import io .appium .java_client .AppiumDriver ;
66import io .appium .java_client .FindsByIosUIAutomation ;
77import io .appium .java_client .MobileElement ;
8+ import io .appium .java_client .ios .internal .JsonToIOSElementConverter ;
89import io .appium .java_client .remote .MobilePlatform ;
910
1011import org .openqa .selenium .Capabilities ;
@@ -21,55 +22,30 @@ public class IOSDriver extends AppiumDriver implements IOSDeviceActionShortcuts,
2122 public IOSDriver (URL remoteAddress , Capabilities desiredCapabilities ) {
2223 super (remoteAddress , substituteMobilePlatform (desiredCapabilities ,
2324 IOS_PLATFORM ));
25+ this .setElementConverter (new JsonToIOSElementConverter (this ));
2426 }
2527
2628 /**
2729 * Scroll to the element whose 'text' attribute contains the input text.
2830 * This scrolling happens within the first UIATableView on the UI. Use the additional 'context' param to specify a different scrollView.
2931 * @param text input text contained in text attribute
3032 */
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+ }
3537
36- /**
38+ /**
3739 * Scroll to the element whose 'text' attribute is equal to the input text.
3840 * This scrolling happens within the first UIATableView on the UI. Use the additional 'context' param to specify a different scrollView.
3941 * @param text input text to match
4042 */
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+ }
7147
72- /**
48+ /**
7349 * @see IOSDeviceActionShortcuts#hideKeyboard(String, String)
7450 */
7551 @ Override
0 commit comments