Created
June 3, 2011 09:51
-
-
Save freynaud/1006111 to your computer and use it in GitHub Desktop.
FF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Eclipse Workspace Patch 1.0 | |
#P selenium | |
Index: java/client/src/org/openqa/selenium/firefox/internal/NewProfileExtensionConnection.java | |
=================================================================== | |
--- java/client/src/org/openqa/selenium/firefox/internal/NewProfileExtensionConnection.java (revision 11993) | |
+++ java/client/src/org/openqa/selenium/firefox/internal/NewProfileExtensionConnection.java (working copy) | |
@@ -65,7 +65,7 @@ | |
this.process = binary; | |
} | |
- public void start() throws IOException { | |
+ public void start(String...args) throws IOException { | |
int port = 0; | |
lock.lock(connectTimeout); | |
@@ -82,7 +82,7 @@ | |
File logFile = firefoxLogFile == null ? null : new File(firefoxLogFile); | |
process.setOutputWatcher(new CircularOutputStream(logFile, BUFFER_SIZE)); | |
- process.startProfile(profile, profileDir); | |
+ process.startProfile(profile, profileDir,args); | |
// Just for the record; the critical section is all along while firefox is starting with the profile. | |
Index: java/client/test/org/openqa/selenium/firefox/FirefoxDriverTest.java | |
=================================================================== | |
--- java/client/test/org/openqa/selenium/firefox/FirefoxDriverTest.java (revision 11993) | |
+++ java/client/test/org/openqa/selenium/firefox/FirefoxDriverTest.java (working copy) | |
@@ -138,7 +138,7 @@ | |
binary.setEnvironmentProperty("NSPR_LOG_MODULES", "all:5"); | |
// We will have an infinite hang if this driver does not start properly | |
- new FirefoxDriver(binary, null).quit(); | |
+ new FirefoxDriver(binary, null,null).quit(); | |
} | |
private static boolean platformHasNativeEvents() { | |
Index: java/client/src/org/openqa/selenium/firefox/FirefoxBinary.java | |
=================================================================== | |
--- java/client/src/org/openqa/selenium/firefox/FirefoxBinary.java (revision 11993) | |
+++ java/client/src/org/openqa/selenium/firefox/FirefoxBinary.java (working copy) | |
@@ -272,7 +272,7 @@ | |
} | |
public void clean(FirefoxProfile profile, File profileDir) throws IOException { | |
- startProfile(profile, profileDir, "-silent"); | |
+ startProfile(profile, profileDir, "-silent", "--display",":1"); | |
try { | |
waitFor(); | |
} catch (InterruptedException e) { | |
Index: java/client/src/org/openqa/selenium/firefox/ExtensionConnection.java | |
=================================================================== | |
--- java/client/src/org/openqa/selenium/firefox/ExtensionConnection.java (revision 11993) | |
+++ java/client/src/org/openqa/selenium/firefox/ExtensionConnection.java (working copy) | |
@@ -30,7 +30,7 @@ | |
* Establishes a connection to the extension. | |
* @throws IOException If an I/O error occurs. | |
*/ | |
- void start() throws IOException; | |
+ void start(String ... args) throws IOException; | |
/** | |
* @return Whether the extension is reachable and accepting requests. | |
Index: java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java | |
=================================================================== | |
--- java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java (revision 11993) | |
+++ java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java (working copy) | |
@@ -67,6 +67,7 @@ | |
private CommandExecutor executor; | |
private Capabilities capabilities; | |
+ private Capabilities requestedCapabilities; | |
private SessionId sessionId; | |
private JsonToWebElementConverter converter; | |
@@ -81,11 +82,16 @@ | |
public RemoteWebDriver(CommandExecutor executor, Capabilities desiredCapabilities) { | |
this.executor = executor; | |
+ this.requestedCapabilities = desiredCapabilities; | |
converter = new JsonToWebElementConverter(this); | |
startClient(); | |
startSession(desiredCapabilities); | |
} | |
+ public Capabilities getRequestedCapabilities() { | |
+ return requestedCapabilities; | |
+ } | |
+ | |
public RemoteWebDriver(Capabilities desiredCapabilities) { | |
this((URL) null, desiredCapabilities); | |
} | |
Index: java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java | |
=================================================================== | |
--- java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java (revision 11993) | |
+++ java/client/src/org/openqa/selenium/firefox/FirefoxDriver.java (working copy) | |
@@ -74,15 +74,15 @@ | |
protected FirefoxBinary binary; | |
public FirefoxDriver() { | |
- this(new FirefoxBinary(), null); | |
+ this(new FirefoxBinary(), null,null); | |
} | |
public FirefoxDriver(FirefoxProfile profile) { | |
- this(new FirefoxBinary(), profile); | |
+ this(new FirefoxBinary(), profile,null); | |
} | |
public FirefoxDriver(Capabilities capabilities) { | |
- this(getBinary(capabilities), extractProfile(capabilities)); | |
+ this(getBinary(capabilities), extractProfile(capabilities),capabilities); | |
} | |
private static FirefoxProfile extractProfile(Capabilities capabilities) { | |
@@ -117,8 +117,8 @@ | |
return new FirefoxBinary(); | |
} | |
- public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile) { | |
- super(new LazyCommandExecutor(binary, profile), DesiredCapabilities.firefox()); | |
+ public FirefoxDriver(FirefoxBinary binary, FirefoxProfile profile,Capabilities capabilities) { | |
+ super(new LazyCommandExecutor(binary, profile), capabilities); | |
this.binary = binary; | |
setElementConverter(new JsonToWebElementConverter(this) { | |
@Override | |
@@ -139,7 +139,12 @@ | |
exe.setConnection(connection); | |
try { | |
- connection.start(); | |
+ String[] cla = new String[]{}; | |
+ if (getRequestedCapabilities()!=null){ | |
+ //cla = (String[])getRequestedCapabilities().getCapability("cla"); | |
+ cla = new String[]{"--display",":1"}; | |
+ } | |
+ connection.start(cla); | |
} catch (IOException e) { | |
throw new WebDriverException("An error occurred while connecting to Firefox", e); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment