File tree 2 files changed +22
-12
lines changed
src/org/openqa/selenium/chromium
test/org/openqa/selenium/chrome
2 files changed +22
-12
lines changed Original file line number Diff line number Diff line change 24
24
import java .io .File ;
25
25
import java .io .IOException ;
26
26
import java .nio .file .Files ;
27
- import java .util .ArrayList ;
28
- import java .util .Arrays ;
29
- import java .util .Base64 ;
30
- import java .util .Collections ;
31
- import java .util .HashMap ;
32
- import java .util .List ;
33
- import java .util .Map ;
34
- import java .util .Set ;
35
- import java .util .TreeMap ;
27
+ import java .util .*;
36
28
import java .util .stream .Stream ;
37
29
import org .openqa .selenium .Capabilities ;
38
30
import org .openqa .selenium .SessionNotCreatedException ;
@@ -320,10 +312,13 @@ protected void mergeInPlace(Capabilities capabilities) {
320
312
}
321
313
addExtensions (options .extensionFiles );
322
314
addEncodedExtensions (options .extensions );
323
- if ( options . binary != null ) {
324
- setBinary (options .binary );
325
- }
315
+
316
+ Optional . ofNullable (options .binary ). ifPresent ( this :: setBinary );
317
+
326
318
options .experimentalOptions .forEach (this ::setExperimentalOption );
319
+
320
+ Optional .ofNullable (options .androidOptions )
321
+ .ifPresent (opts -> opts .forEach (this ::setAndroidCapability ));
327
322
}
328
323
}
329
324
Original file line number Diff line number Diff line change 23
23
import static org .assertj .core .api .InstanceOfAssertFactories .LIST ;
24
24
import static org .assertj .core .api .InstanceOfAssertFactories .MAP ;
25
25
import static org .assertj .core .api .InstanceOfAssertFactories .STRING ;
26
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
26
27
import static org .openqa .selenium .chromium .ChromiumDriverLogLevel .OFF ;
27
28
import static org .openqa .selenium .chromium .ChromiumDriverLogLevel .SEVERE ;
28
29
import static org .openqa .selenium .remote .CapabilityType .ACCEPT_INSECURE_CERTS ;
@@ -382,4 +383,18 @@ void shouldBeAbleToSetAnAndroidOption() {
382
383
.extractingByKey ("androidActivity" )
383
384
.isEqualTo ("com.cheese.nom" );
384
385
}
386
+
387
+ @ Test
388
+ void shouldBeAbleToMergeAnAndroidOption () {
389
+ var original = new ChromeOptions ();
390
+ original .setAndroidActivity ("co_activity" );
391
+ original .setAndroidPackage ("co_package" );
392
+ original .setExperimentalOption ("experimental" , "co_experimental" );
393
+ original .addArguments ("--co_argument" );
394
+
395
+ var caps = new MutableCapabilities ();
396
+ var merged = original .merge (caps );
397
+
398
+ assertEquals (original .asMap (), merged .asMap ());
399
+ }
385
400
}
You can’t perform that action at this time.
0 commit comments