Created
September 17, 2010 10:02
-
-
Save bosko/584005 to your computer and use it in GitHub Desktop.
Selenium on Windows fix
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
From 9037f152c9ae2f1f473a926b65b2647ca7730d27 Mon Sep 17 00:00:00 2001 | |
From: Bosko Ivanisevic <[email protected]> | |
Date: Fri, 17 Sep 2010 11:55:35 +0200 | |
Subject: [PATCH] Fix using Selenium on mingw based Ruby on Windows | |
--- | |
lib/webrat/selenium/selenium_rc_server.rb | 6 +++--- | |
lib/webrat/selenium/silence_stream.rb | 2 +- | |
2 files changed, 4 insertions(+), 4 deletions(-) | |
diff --git a/lib/webrat/selenium/selenium_rc_server.rb b/lib/webrat/selenium/selenium_rc_server.rb | |
index 46ce5aa..0e33710 100644 | |
--- a/lib/webrat/selenium/selenium_rc_server.rb | |
+++ b/lib/webrat/selenium/selenium_rc_server.rb | |
@@ -34,7 +34,7 @@ module Webrat | |
server_options = { :timeout => Webrat.configuration.selenium_browser_startup_timeout } | |
server_options[:firefox_profile] = Webrat.configuration.selenium_firefox_profile if Webrat.configuration.selenium_firefox_profile | |
- @remote_control = ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0", | |
+ @remote_control = ::Selenium::RemoteControl::RemoteControl.new(Webrat.configuration.selenium_server_address || "0.0.0.0", | |
Webrat.configuration.selenium_server_port, | |
server_options) | |
@@ -48,7 +48,7 @@ module Webrat | |
end | |
def selenium_grid? | |
- Webrat.configuration.selenium_server_address | |
+ Webrat.configuration.selenium_server_address and !(::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/) | |
end | |
def wait | |
@@ -77,7 +77,7 @@ module Webrat | |
def stop | |
silence_stream(STDOUT) do | |
- ::Selenium::RemoteControl::RemoteControl.new("0.0.0.0", | |
+ ::Selenium::RemoteControl::RemoteControl.new(Webrat.configuration.selenium_server_address || "0.0.0.0", | |
Webrat.configuration.selenium_server_port, | |
:timeout => 5).stop | |
end | |
diff --git a/lib/webrat/selenium/silence_stream.rb b/lib/webrat/selenium/silence_stream.rb | |
index e1e6c74..71e375f 100644 | |
--- a/lib/webrat/selenium/silence_stream.rb | |
+++ b/lib/webrat/selenium/silence_stream.rb | |
@@ -6,7 +6,7 @@ module Webrat | |
unless Kernel.respond_to?(:silence_stream) | |
def silence_stream(stream) | |
old_stream = stream.dup | |
- stream.reopen(RUBY_PLATFORM =~ /mswin/ ? 'NUL:' : '/dev/null') | |
+ stream.reopen( ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null') | |
stream.sync = true | |
yield | |
ensure | |
-- | |
1.7.2.3.msysgit.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment