14
14
* limitations under the License.
15
15
*/
16
16
17
-
18
17
package io .appium .java_client ;
19
18
20
19
import static com .google .common .base .Preconditions .checkNotNull ;
21
20
22
- import static io .appium .java_client .MobileCommand .GET_SESSION ;
23
-
24
21
import com .google .common .collect .ImmutableMap ;
25
22
26
23
import io .appium .java_client .remote .AppiumCommandExecutor ;
58
55
import java .util .Map ;
59
56
import java .util .Set ;
60
57
61
-
62
58
/**
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
+ */
73
69
@ SuppressWarnings ("unchecked" )
74
70
public abstract class AppiumDriver <T extends WebElement >
75
71
extends DefaultGenericMobileDriver <T > {
@@ -81,13 +77,13 @@ public abstract class AppiumDriver<T extends WebElement>
81
77
private ExecuteMethod executeMethod ;
82
78
83
79
/**
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}
89
85
* @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
91
87
* JSON response to an instance of
92
88
* {@link org.openqa.selenium.WebElement}
93
89
*/
@@ -100,10 +96,10 @@ protected AppiumDriver(HttpCommandExecutor executor, Capabilities capabilities,
100
96
this .remoteAddress = executor .getAddressOfRemoteServer ();
101
97
try {
102
98
Constructor <? extends JsonToWebElementConverter > constructor =
103
- converterClazz .getConstructor (RemoteWebDriver .class );
99
+ converterClazz .getConstructor (RemoteWebDriver .class );
104
100
this .setElementConverter (constructor .newInstance (this ));
105
101
} catch (NoSuchMethodException | IllegalAccessException | InstantiationException
106
- | InvocationTargetException e ) {
102
+ | InvocationTargetException e ) {
107
103
throw new RuntimeException (e );
108
104
}
109
105
}
@@ -116,7 +112,7 @@ public AppiumDriver(URL remoteAddress, Capabilities desiredCapabilities,
116
112
117
113
public AppiumDriver (URL remoteAddress , HttpClient .Factory httpClientFactory ,
118
114
Capabilities desiredCapabilities ,
119
- Class <? extends JsonToWebElementConverter > converterClazz ) {
115
+ Class <? extends JsonToWebElementConverter > converterClazz ) {
120
116
this (new AppiumCommandExecutor (MobileCommand .commandRepository , remoteAddress ,
121
117
httpClientFactory ), desiredCapabilities , converterClazz );
122
118
}
@@ -129,7 +125,7 @@ public AppiumDriver(AppiumDriverLocalService service, Capabilities desiredCapabi
129
125
130
126
public AppiumDriver (AppiumDriverLocalService service , HttpClient .Factory httpClientFactory ,
131
127
Capabilities desiredCapabilities ,
132
- Class <? extends JsonToWebElementConverter > converterClazz ) {
128
+ Class <? extends JsonToWebElementConverter > converterClazz ) {
133
129
this (new AppiumCommandExecutor (MobileCommand .commandRepository , service , httpClientFactory ),
134
130
desiredCapabilities , converterClazz );
135
131
}
@@ -141,14 +137,14 @@ public AppiumDriver(AppiumServiceBuilder builder, Capabilities desiredCapabiliti
141
137
142
138
public AppiumDriver (AppiumServiceBuilder builder , HttpClient .Factory httpClientFactory ,
143
139
Capabilities desiredCapabilities ,
144
- Class <? extends JsonToWebElementConverter > converterClazz ) {
140
+ Class <? extends JsonToWebElementConverter > converterClazz ) {
145
141
this (builder .build (), httpClientFactory , desiredCapabilities , converterClazz );
146
142
}
147
143
148
144
public AppiumDriver (HttpClient .Factory httpClientFactory , Capabilities desiredCapabilities ,
149
145
Class <? extends JsonToWebElementConverter > converterClazz ) {
150
- this (AppiumDriverLocalService .buildDefaultService (), httpClientFactory , desiredCapabilities ,
151
- converterClazz );
146
+ this (AppiumDriverLocalService .buildDefaultService (), httpClientFactory ,
147
+ desiredCapabilities , converterClazz );
152
148
}
153
149
154
150
public AppiumDriver (Capabilities desiredCapabilities ,
@@ -158,8 +154,8 @@ public AppiumDriver(Capabilities desiredCapabilities,
158
154
159
155
/**
160
156
* @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
163
159
* @return {@link Capabilities} with changed mobile platform value
164
160
*/
165
161
protected static Capabilities substituteMobilePlatform (Capabilities originalCapabilities ,
@@ -414,7 +410,7 @@ public void zoom(int x, int y) {
414
410
@ Override public DeviceRotation rotation () {
415
411
Response response = execute (DriverCommand .GET_SCREEN_ROTATION );
416
412
DeviceRotation deviceRotation =
417
- new DeviceRotation ((Map <String , Number >) response .getValue ());
413
+ new DeviceRotation ((Map <String , Number >) response .getValue ());
418
414
if (deviceRotation .getX () < 0 || deviceRotation .getY () < 0 || deviceRotation .getZ () < 0 ) {
419
415
throw new WebDriverException ("Unexpected orientation returned: " + deviceRotation );
420
416
}
@@ -428,7 +424,7 @@ public void zoom(int x, int y) {
428
424
429
425
@ Override public void rotate (ScreenOrientation orientation ) {
430
426
execute (DriverCommand .SET_SCREEN_ORIENTATION ,
431
- ImmutableMap .of ("orientation" , orientation .value ().toUpperCase ()));
427
+ ImmutableMap .of ("orientation" , orientation .value ().toUpperCase ()));
432
428
}
433
429
434
430
@ Override public ScreenOrientation getOrientation () {
@@ -464,12 +460,4 @@ private TouchAction createTap(int x, int y, int duration) {
464
460
public URL getRemoteAddress () {
465
461
return remoteAddress ;
466
462
}
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
- }
475
463
}
0 commit comments