@@ -137,12 +137,14 @@ By getBy(Annotation annotation) {
137137
138138private final Field mobileField ;
139139private final String platform ;
140+ private final String automation ;
140141
141- AppiumAnnotations (Field field , String platform ) {
142+ AppiumAnnotations (Field field , String platform , String automation ) {
142143super (field );
143144mobileField = field ;
144145this .platform = String .valueOf (platform ).
145146toUpperCase ().trim ();
147+ this .automation = String .valueOf (automation );
146148}
147149
148150private static void checkDisallowedAnnotationPairs (Annotation a1 ,
@@ -161,14 +163,31 @@ private void assertValidAnnotations() {
161163.getAnnotation (AndroidFindBys .class );
162164AndroidFindAll androidFindAll = mobileField .
163165getAnnotation (AndroidFindAll .class );
164-
166+
167+ SelendroidFindBy selendroidBy = mobileField
168+ .getAnnotation (SelendroidFindBy .class );
169+ SelendroidFindBys selendroidBys = mobileField
170+ .getAnnotation (SelendroidFindBys .class );
171+ SelendroidFindAll selendroidFindAll = mobileField .
172+ getAnnotation (SelendroidFindAll .class );
173+
165174iOSFindBy iOSBy = mobileField .getAnnotation (iOSFindBy .class );
166175iOSFindBys iOSBys = mobileField .getAnnotation (iOSFindBys .class );
167176iOSFindAll iOSFindAll = mobileField .getAnnotation (iOSFindAll .class );
168177
169178checkDisallowedAnnotationPairs (androidBy , androidBys );
179+ checkDisallowedAnnotationPairs (androidBy , selendroidBys );
170180checkDisallowedAnnotationPairs (androidBy , androidFindAll );
181+ checkDisallowedAnnotationPairs (androidBy , selendroidFindAll );
171182checkDisallowedAnnotationPairs (androidBys , androidFindAll );
183+ checkDisallowedAnnotationPairs (androidBys , selendroidFindAll );
184+
185+ checkDisallowedAnnotationPairs (selendroidBy , androidBys );
186+ checkDisallowedAnnotationPairs (selendroidBy , selendroidBys );
187+ checkDisallowedAnnotationPairs (selendroidBy , androidFindAll );
188+ checkDisallowedAnnotationPairs (selendroidBy , selendroidFindAll );
189+ checkDisallowedAnnotationPairs (selendroidBys , androidFindAll );
190+ checkDisallowedAnnotationPairs (selendroidBys , selendroidFindAll );
172191
173192checkDisallowedAnnotationPairs (iOSBy , iOSBys );
174193checkDisallowedAnnotationPairs (iOSBy , iOSFindAll );
@@ -248,12 +267,34 @@ private <T extends By> T getComplexMobileBy(Annotation[] annotations, Class<T> r
248267public By buildBy () {
249268assertValidAnnotations ();
250269
270+ SelendroidFindBy selendroidBy = mobileField
271+ .getAnnotation (SelendroidFindBy .class );
272+ if (selendroidBy != null && ANDROID .toUpperCase ().equals (platform ) &&
273+ "Selendroid" .equals (automation )) {
274+ return getMobileBy (selendroidBy , getFilledValue (selendroidBy ));
275+ }
276+
277+ SelendroidFindBys selendroidBys = mobileField
278+ .getAnnotation (SelendroidFindBys .class );
279+ if (selendroidBy != null && ANDROID .toUpperCase ().equals (platform ) &&
280+ "Selendroid" .equals (automation )) {
281+ return getMobileBy (selendroidBys , getFilledValue (selendroidBys ));
282+ }
283+
284+ SelendroidFindAll selendroidAll = mobileField
285+ .getAnnotation (SelendroidFindAll .class );
286+ if (selendroidBy != null && ANDROID .toUpperCase ().equals (platform ) &&
287+ "Selendroid" .equals (automation )) {
288+ return getMobileBy (selendroidAll , getFilledValue (selendroidAll ));
289+ }
290+
291+
251292AndroidFindBy androidBy = mobileField
252293.getAnnotation (AndroidFindBy .class );
253294if (androidBy != null && ANDROID .toUpperCase ().equals (platform )) {
254295return getMobileBy (androidBy , getFilledValue (androidBy ));
255296}
256-
297+
257298AndroidFindBys androidBys = mobileField
258299.getAnnotation (AndroidFindBys .class );
259300if (androidBys != null && ANDROID .toUpperCase ().equals (platform )) {
@@ -265,6 +306,7 @@ public By buildBy() {
265306return getComplexMobileBy (androidFindAll .value (), ByAll .class );
266307}
267308
309+
268310iOSFindBy iOSBy = mobileField .getAnnotation (iOSFindBy .class );
269311if (iOSBy != null && IOS .toUpperCase ().equals (platform )) {
270312return getMobileBy (iOSBy , getFilledValue (iOSBy ));
0 commit comments