File tree 4 files changed +13
-0
lines changed
src/org/openqa/selenium/remote
4 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 19
19
20
20
import static org .openqa .selenium .remote .CapabilityType .ACCEPT_INSECURE_CERTS ;
21
21
import static org .openqa .selenium .remote .CapabilityType .BROWSER_VERSION ;
22
+ import static org .openqa .selenium .remote .CapabilityType .ENABLE_DOWNLOADS ;
22
23
import static org .openqa .selenium .remote .CapabilityType .PAGE_LOAD_STRATEGY ;
23
24
import static org .openqa .selenium .remote .CapabilityType .PLATFORM_NAME ;
24
25
import static org .openqa .selenium .remote .CapabilityType .PROXY ;
@@ -101,6 +102,11 @@ public DO setProxy(Proxy proxy) {
101
102
return (DO ) this ;
102
103
}
103
104
105
+ public DO setEnableDownloads (boolean enableDownloads ) {
106
+ setCapability (ENABLE_DOWNLOADS , enableDownloads );
107
+ return (DO ) this ;
108
+ }
109
+
104
110
@ Override
105
111
public Set <String > getCapabilityNames () {
106
112
TreeSet <String > names = new TreeSet <>(super .getCapabilityNames ());
Original file line number Diff line number Diff line change @@ -30,4 +30,5 @@ public interface CapabilityType {
30
30
String TIMEOUTS = "timeouts" ;
31
31
String STRICT_FILE_INTERACTABILITY = "strictFileInteractability" ;
32
32
String UNHANDLED_PROMPT_BEHAVIOUR = "unhandledPromptBehavior" ;
33
+ String ENABLE_DOWNLOADS = "se:downloadsEnabled" ;
33
34
}
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ void canAddW3CCompliantOptions() {
84
84
.setAcceptInsecureCerts (true )
85
85
.setPageLoadStrategy (PageLoadStrategy .EAGER )
86
86
.setStrictFileInteractability (true )
87
+ .setEnableDownloads (true )
87
88
.setImplicitWaitTimeout (Duration .ofSeconds (1 ))
88
89
.setPageLoadTimeout (Duration .ofSeconds (2 ))
89
90
.setScriptTimeout (Duration .ofSeconds (3 ));
@@ -96,6 +97,7 @@ void canAddW3CCompliantOptions() {
96
97
assertThat (mappedOptions .get ("acceptInsecureCerts" )).isEqualTo (true );
97
98
assertThat (mappedOptions .get ("pageLoadStrategy" )).hasToString ("eager" );
98
99
assertThat (mappedOptions .get ("strictFileInteractability" )).isEqualTo (true );
100
+ assertThat (mappedOptions .get ("se:downloadsEnabled" )).isEqualTo (true );
99
101
100
102
Map <String , Long > expectedTimeouts = new HashMap <>();
101
103
expectedTimeouts .put ("implicit" , 1000L );
Original file line number Diff line number Diff line change 42
42
import org .openqa .selenium .PersistentCapabilities ;
43
43
import org .openqa .selenium .WebDriver ;
44
44
import org .openqa .selenium .WebDriverException ;
45
+ import org .openqa .selenium .chrome .ChromeOptions ;
45
46
import org .openqa .selenium .environment .webserver .NettyAppServer ;
46
47
import org .openqa .selenium .grid .config .TomlConfig ;
47
48
import org .openqa .selenium .grid .router .DeploymentTypes .Deployment ;
@@ -67,6 +68,9 @@ class RemoteWebDriverDownloadTest {
67
68
public void setupServers () {
68
69
Browser browser = Browser .detect ();
69
70
assert browser != null ;
71
+ ChromeOptions options = new ChromeOptions ();
72
+ options .setEnableDownloads (true );
73
+
70
74
capabilities =
71
75
new PersistentCapabilities (browser .getCapabilities ())
72
76
.setCapability ("se:downloadsEnabled" , true );
You can’t perform that action at this time.
0 commit comments