Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
First go at ie browser launcher.
-Mikeal



git-svn-id: http://svn.getwindmill.com/trunk@175 78c7df6f-8922-0410-bcd3-9426b1ad491b
  • Loading branch information
mikeal committed Apr 30, 2007
1 parent 51342af commit 8f30170
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
1 change: 0 additions & 1 deletion windmill/browser/firefox.py
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import webbrowser
import windmill
import exceptions
import os, sys, shutil, time, signal
Expand Down
60 changes: 60 additions & 0 deletions windmill/browser/ie.py
@@ -0,0 +1,60 @@
import windmill
import exceptions
import os, sys, shutil, time, signal
import killableprocess
import logging

if sys.platform == "win32" or sys.platform == "cygwin":
import _winreg as wreg

logger = logging.getLogger(__name__)

PROXY_PORT = windmill.settings['SERVER_HTTP_PORT']
DEFAULT_TEST_URL = windmill.settings['TEST_URL']+'/windmill-serv/start.html'
IE_BINARY = windmill.settings['IE_BINARY']

class InternetExplorer(object):

def __init__(self, proxy_port=PROXY_PORT, test_url=DEFAULT_TEST_URL, ie_binary=IE_BINARY):

self.proxy_port = proxy_port
self.test_url = test_url
self.reg = wreg.OpenKey(wreg.HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings")
self.cmd = [ie_binary, self.test_url]

def start(self):

wreg.SetValueEx(self.reg, 'MigrateProxy', 0, wreg.REG_DWORD, 00000001)
wreg.SetValueEx(self.reg, 'ProxyEnable', 0, wreg.REG_DWORD, 00000001)
wreg.SetValueEx(self.reg, 'ProxyHttp1.1', 0, wreg.REG_DWORD, 00000000)
wreg.SetValue(self.reg, "ProxyServer", wreg.REG_SZ, "http://ProxyServername:%s" % self.proxy_port)

self.p_handle = killableprocess.Popen(self.cmd)

def stop(self):

wreg.DeleteKey(self.reg, 'MigrateProxy')
wreg.DeleteKey(self.reg, 'ProxyEnable')
wreg.DeleteKey(self.reg, 'ProxyHttp1.1')
wreg.DeleteKey(self.reg, 'ProxyServer')

try:
self.p_handle.kill(group=True)
except:
logger.error('Cannot kill firefox')

def is_alive(self):

if self.p_handle.poll() is None:
return False

try:
self.p_handle.kill(group=True)
return True
except exceptions.OSError:
return False




1 change: 1 addition & 0 deletions windmill/conf/global_settings.py
Expand Up @@ -68,3 +68,4 @@
elif sys.platform == 'win32':
MOZILLA_BINARY = "C:\\Program Files\\Mozilla Firefox\\firefox.exe"
MOZILLA_DEFAULT_PROFILE = "C:\Program Files\Mozilla Firefox\defaults\profile"
IE_BINARY = "C:\\Program Files\\Internet Explorer\\iexpore.exe"

0 comments on commit 8f30170

Please sign in to comment.