1414 * limitations under the License.
1515 */
1616
17-
1817package io .appium .java_client ;
1918
2019import static com .google .common .base .Preconditions .checkNotNull ;
2120
22- import static io .appium .java_client .MobileCommand .GET_SESSION ;
23-
2421import com .google .common .collect .ImmutableMap ;
2522
2623import io .appium .java_client .remote .AppiumCommandExecutor ;
5855import java .util .Map ;
5956import java .util .Set ;
6057
61-
6258/**
63- * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.
64- * Instances of the defined type will be returned via findElement* and findElements*
65- * Warning (!!!). Allowed types:
66- * {@link org.openqa.selenium.WebElement}
67- * {@link io.appium.java_client.TouchableElement}
68- * {@link org.openqa.selenium.remote.RemoteWebElement}
69- * {@link io.appium.java_client.MobileElement} and its subclasses that designed
70- * specifically
71- * for each target mobile OS (still Android and iOS)
72- */
59+ * @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.
60+ * Instances of the defined type will be returned via findElement* and findElements*
61+ * Warning (!!!). Allowed types:
62+ * {@link org.openqa.selenium.WebElement}
63+ * {@link io.appium.java_client.TouchableElement}
64+ * {@link org.openqa.selenium.remote.RemoteWebElement}
65+ * {@link io.appium.java_client.MobileElement} and its subclasses that designed
66+ * specifically
67+ * for each target mobile OS (still Android and iOS)
68+ */
7369@ SuppressWarnings ("unchecked" )
7470public abstract class AppiumDriver <T extends WebElement >
7571 extends DefaultGenericMobileDriver <T > {
@@ -81,13 +77,13 @@ public abstract class AppiumDriver<T extends WebElement>
8177 private ExecuteMethod executeMethod ;
8278
8379 /**
84- * @param executor is an instance of {@link org.openqa.selenium.remote.HttpCommandExecutor}
85- * or class that extends it. Default commands or another vendor-specific
86- * commands may be specified there.
87- * @param capabilities take a look
88- * at {@link org.openqa.selenium.Capabilities}
80+ * @param executor is an instance of {@link org.openqa.selenium.remote.HttpCommandExecutor}
81+ * or class that extends it. Default commands or another vendor-specific
82+ * commands may be specified there.
83+ * @param capabilities take a look
84+ * at {@link org.openqa.selenium.Capabilities}
8985 * @param converterClazz is an instance of a class that extends
90- * {@link org.openqa.selenium.remote.internal.JsonToWebElementConverter}. It converts
86+ * {@link org.openqa.selenium.remote.internal.JsonToWebElementConverter}. It converts
9187 * JSON response to an instance of
9288 * {@link org.openqa.selenium.WebElement}
9389 */
@@ -100,10 +96,10 @@ protected AppiumDriver(HttpCommandExecutor executor, Capabilities capabilities,
10096 this .remoteAddress = executor .getAddressOfRemoteServer ();
10197 try {
10298 Constructor <? extends JsonToWebElementConverter > constructor =
103- converterClazz .getConstructor (RemoteWebDriver .class );
99+ converterClazz .getConstructor (RemoteWebDriver .class );
104100 this .setElementConverter (constructor .newInstance (this ));
105101 } catch (NoSuchMethodException | IllegalAccessException | InstantiationException
106- | InvocationTargetException e ) {
102+ | InvocationTargetException e ) {
107103 throw new RuntimeException (e );
108104 }
109105 }
@@ -116,7 +112,7 @@ public AppiumDriver(URL remoteAddress, Capabilities desiredCapabilities,
116112
117113 public AppiumDriver (URL remoteAddress , HttpClient .Factory httpClientFactory ,
118114 Capabilities desiredCapabilities ,
119- Class <? extends JsonToWebElementConverter > converterClazz ) {
115+ Class <? extends JsonToWebElementConverter > converterClazz ) {
120116 this (new AppiumCommandExecutor (MobileCommand .commandRepository , remoteAddress ,
121117 httpClientFactory ), desiredCapabilities , converterClazz );
122118 }
@@ -129,7 +125,7 @@ public AppiumDriver(AppiumDriverLocalService service, Capabilities desiredCapabi
129125
130126 public AppiumDriver (AppiumDriverLocalService service , HttpClient .Factory httpClientFactory ,
131127 Capabilities desiredCapabilities ,
132- Class <? extends JsonToWebElementConverter > converterClazz ) {
128+ Class <? extends JsonToWebElementConverter > converterClazz ) {
133129 this (new AppiumCommandExecutor (MobileCommand .commandRepository , service , httpClientFactory ),
134130 desiredCapabilities , converterClazz );
135131 }
@@ -141,14 +137,14 @@ public AppiumDriver(AppiumServiceBuilder builder, Capabilities desiredCapabiliti
141137
142138 public AppiumDriver (AppiumServiceBuilder builder , HttpClient .Factory httpClientFactory ,
143139 Capabilities desiredCapabilities ,
144- Class <? extends JsonToWebElementConverter > converterClazz ) {
140+ Class <? extends JsonToWebElementConverter > converterClazz ) {
145141 this (builder .build (), httpClientFactory , desiredCapabilities , converterClazz );
146142 }
147143
148144 public AppiumDriver (HttpClient .Factory httpClientFactory , Capabilities desiredCapabilities ,
149145 Class <? extends JsonToWebElementConverter > converterClazz ) {
150- this (AppiumDriverLocalService .buildDefaultService (), httpClientFactory , desiredCapabilities ,
151- converterClazz );
146+ this (AppiumDriverLocalService .buildDefaultService (), httpClientFactory ,
147+ desiredCapabilities , converterClazz );
152148 }
153149
154150 public AppiumDriver (Capabilities desiredCapabilities ,
@@ -158,8 +154,8 @@ public AppiumDriver(Capabilities desiredCapabilities,
158154
159155 /**
160156 * @param originalCapabilities the given {@link Capabilities}.
161- * @param newPlatform a {@link MobileCapabilityType#PLATFORM_NAME} value which has
162- * to be set up
157+ * @param newPlatform a {@link MobileCapabilityType#PLATFORM_NAME} value which has
158+ * to be set up
163159 * @return {@link Capabilities} with changed mobile platform value
164160 */
165161 protected static Capabilities substituteMobilePlatform (Capabilities originalCapabilities ,
@@ -414,7 +410,7 @@ public void zoom(int x, int y) {
414410 @ Override public DeviceRotation rotation () {
415411 Response response = execute (DriverCommand .GET_SCREEN_ROTATION );
416412 DeviceRotation deviceRotation =
417- new DeviceRotation ((Map <String , Number >) response .getValue ());
413+ new DeviceRotation ((Map <String , Number >) response .getValue ());
418414 if (deviceRotation .getX () < 0 || deviceRotation .getY () < 0 || deviceRotation .getZ () < 0 ) {
419415 throw new WebDriverException ("Unexpected orientation returned: " + deviceRotation );
420416 }
@@ -428,7 +424,7 @@ public void zoom(int x, int y) {
428424
429425 @ Override public void rotate (ScreenOrientation orientation ) {
430426 execute (DriverCommand .SET_SCREEN_ORIENTATION ,
431- ImmutableMap .of ("orientation" , orientation .value ().toUpperCase ()));
427+ ImmutableMap .of ("orientation" , orientation .value ().toUpperCase ()));
432428 }
433429
434430 @ Override public ScreenOrientation getOrientation () {
@@ -464,12 +460,4 @@ private TouchAction createTap(int x, int y, int duration) {
464460 public URL getRemoteAddress () {
465461 return remoteAddress ;
466462 }
467-
468- /**
469- * @return a map with values that hold session details.
470- */
471- public Map <String , Object > getSessionDetails () {
472- Response response = execute (GET_SESSION );
473- return (Map <String , Object >) response .getValue ();
474- }
475463}
0 commit comments