17
17
18
18
package org .openqa .selenium .testing .drivers ;
19
19
20
- import static org .openqa .selenium .Platform .WINDOWS ;
21
20
import static org .openqa .selenium .testing .DevMode .isInDevMode ;
22
21
23
22
import com .google .common .base .Supplier ;
24
23
import com .google .common .base .Throwables ;
25
- import com .google .common .io .Files ;
26
24
27
25
import org .openqa .selenium .Capabilities ;
28
- import org .openqa .selenium .Platform ;
29
26
import org .openqa .selenium .WebDriver ;
30
- import org .openqa .selenium .firefox .FirefoxDriver ;
31
- import org .openqa .selenium .firefox .FirefoxProfile ;
32
27
import org .openqa .selenium .remote .DesiredCapabilities ;
33
- import org .openqa .selenium .testing .InProject ;
34
28
35
- import java .io .File ;
36
- import java .io .IOException ;
37
29
import java .lang .reflect .InvocationTargetException ;
38
30
import java .util .logging .Logger ;
39
31
@@ -59,30 +51,6 @@ public WebDriver get() {
59
51
return null ;
60
52
}
61
53
62
- if (DesiredCapabilities .firefox ().getBrowserName ().equals (desiredCapsToUse .getBrowserName ())) {
63
- boolean isMarionette = Boolean .getBoolean (FirefoxDriver .SystemProperty .DRIVER_USE_MARIONETTE );
64
- if (!isMarionette ) {
65
- desiredCapsToUse .setCapability (FirefoxDriver .MARIONETTE , false );
66
- if (isInDevMode ()) {
67
- copyFirefoxDriverDefaultsToOutputDir ();
68
- }
69
-
70
- FirefoxProfile profile = new FirefoxProfile ();
71
- boolean enableNativeEvents = Boolean .getBoolean ("selenium.browser.native_events" ) ||
72
- Platform .getCurrent ().is (WINDOWS );
73
- profile .setEnableNativeEvents (enableNativeEvents );
74
- desiredCapsToUse .setCapability (FirefoxDriver .PROFILE , profile );
75
- }
76
-
77
- try {
78
- return driverClass .getConstructor (Capabilities .class ,
79
- Capabilities .class )
80
- .newInstance (desiredCapsToUse , requiredCapabilities );
81
- } catch (NoSuchMethodException ex ) {
82
- return driverClass .getConstructor (Capabilities .class ).newInstance (desiredCapsToUse );
83
- }
84
- }
85
-
86
54
try {
87
55
return driverClass .getConstructor (Capabilities .class ,
88
56
Capabilities .class ).newInstance (desiredCapsToUse , requiredCapabilities );
@@ -98,25 +66,17 @@ public WebDriver get() {
98
66
}
99
67
}
100
68
101
- private void copyFirefoxDriverDefaultsToOutputDir () throws IOException {
102
- File defaults = InProject .locate ("javascript/firefox-driver/webdriver.json" );
103
- File out = InProject .locate ("java/client/build/production/org/openqa/selenium/firefox/FirefoxProfile.class" ).getParentFile ();
104
- out = new File (out , "webdriver.json" );
105
- Files .copy (defaults , out );
106
- }
107
-
108
69
// Cover your eyes
109
70
private Class <? extends WebDriver > mapToClass (Capabilities caps ) {
110
71
String name = caps == null ? "" : caps .getBrowserName ();
111
- String className = null ;
72
+ String className ;
112
73
113
74
if (DesiredCapabilities .chrome ().getBrowserName ().equals (name )) {
114
75
className = "org.openqa.selenium.testing.drivers.TestChromeDriver" ;
115
76
} else if (DesiredCapabilities .operaBlink ().getBrowserName ().equals (name )) {
116
77
className = "org.openqa.selenium.testing.drivers.TestOperaBlinkDriver" ;
117
78
} else if (DesiredCapabilities .firefox ().getBrowserName ().equals (name )) {
118
- Object marionette = caps .getCapability (FirefoxDriver .MARIONETTE );
119
- if (isInDevMode () && marionette != null && !(Boolean ) marionette ) {
79
+ if (isInDevMode ()) {
120
80
className = "org.openqa.selenium.testing.drivers.SynthesizedFirefoxDriver" ;
121
81
} else {
122
82
className = "org.openqa.selenium.firefox.FirefoxDriver" ;
0 commit comments