File tree 3 files changed +297
-271
lines changed
main/java/io/appium/java_client
test/java/io/appium/java_client/android
3 files changed +297
-271
lines changed Original file line number Diff line number Diff line change 17
17
package io .appium .java_client ;
18
18
19
19
import static io .appium .java_client .MobileCommand .GET_SESSION ;
20
+ import static io .appium .java_client .MobileCommand .GET_ALLSESSION ;
20
21
import static java .util .Optional .ofNullable ;
21
22
import static java .util .stream .Collectors .toMap ;
22
23
import static org .apache .commons .lang3 .StringUtils .isBlank ;
23
24
25
+ import com .google .common .collect .ImmutableList ;
24
26
import com .google .common .collect .ImmutableMap ;
25
27
26
28
import org .openqa .selenium .remote .Response ;
27
29
30
+ import java .util .Arrays ;
31
+ import java .util .List ;
28
32
import java .util .Map ;
33
+
29
34
import javax .annotation .Nullable ;
30
35
31
36
public interface HasSessionDetails extends ExecutesMethod {
@@ -86,4 +91,16 @@ default boolean isBrowser() {
86
91
return ofNullable (getSessionDetail ("browserName" ))
87
92
.orElse (null ) != null ;
88
93
}
94
+
95
+ /**
96
+ * Get All Sessions details
97
+ * @return List of Map objects with All Session Details
98
+ */
99
+ @ SuppressWarnings ("unchecked" )
100
+ default List <Map <String , Object >> getAllSessionDetails () {
101
+ Response response = execute (GET_ALLSESSION );
102
+ List <Map <String ,Object >> resultSet = List .class .cast (response .getValue ());
103
+ return ImmutableList .<Map <String ,Object >>builder ().addAll (resultSet ).build ();
104
+ }
105
+
89
106
}
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ public class MobileCommand {
111
111
protected static final String TOGGLE_DATA ;
112
112
protected static final String COMPARE_IMAGES ;
113
113
protected static final String EXECUTE_DRIVER_SCRIPT ;
114
+ protected static final String GET_ALLSESSION ;
114
115
115
116
public static final Map <String , CommandInfo > commandRepository ;
116
117
@@ -186,6 +187,7 @@ public class MobileCommand {
186
187
TOGGLE_DATA = "toggleData" ;
187
188
COMPARE_IMAGES = "compareImages" ;
188
189
EXECUTE_DRIVER_SCRIPT = "executeDriverScript" ;
190
+ GET_ALLSESSION = "getAllSessions" ;
189
191
190
192
commandRepository = new HashMap <>();
191
193
commandRepository .put (RESET , postC ("/session/:sessionId/appium/app/reset" ));
@@ -271,6 +273,8 @@ public class MobileCommand {
271
273
commandRepository .put (TOGGLE_DATA , postC ("/session/:sessionId/appium/device/toggle_data" ));
272
274
commandRepository .put (COMPARE_IMAGES , postC ("/session/:sessionId/appium/compare_images" ));
273
275
commandRepository .put (EXECUTE_DRIVER_SCRIPT , postC ("/session/:sessionId/appium/execute_driver" ));
276
+ //Get All Session Details
277
+ commandRepository .put (GET_ALLSESSION , getC ("/sessions" ));
274
278
}
275
279
276
280
/**
You can’t perform that action at this time.
0 commit comments