Skip to content

Commit

Permalink
DavidBurns adding x64 IE support to Python
Browse files Browse the repository at this point in the history
r13307
  • Loading branch information
AutomatedTester committed Aug 9, 2011
1 parent 8b6d97b commit 4d043cd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ recursive-include py/selenium/webdriver/common *.py
recursive-include py/selenium/common *.py
recursive-include py/selenium/webdriver/chrome *.py
recursive-include py/selenium/webdriver/firefox *.py *.xpi
recursive-include py/selenium/webdriver/ie *.py *.dll
recursive-include py/selenium/webdriver/ie *.py
recursive-include py/selenium/webdriver/ie/win32 *.dll
recursive-include py/selenium/webdriver/ie/x64 *.dll
recursive-include py/selenium/webdriver/remote *.py
recursive-include py/selenium/webdriver/support *.py
include py/selenium/selenium.py
Expand Down
26 changes: 19 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,15 @@ task :test_ie_py => :webdriver_py do
win = windows?
if win != nil then
if python? then
cp 'cpp\\prebuilt\\Win32\\Release\\IEDriver.dll', "py\\selenium\\webdriver\\ie", :verbose => true
sh "build\\python\\Scripts\\python setup.py build", :verbose => true
win32 = "py\\selenium\\webdriver\\ie\\win32\\"
x64 = "py\\selenium\\webdriver\\ie\\x64\\"
mkdir_p win32 unless File.exists?(win32)
mkdir_p x64 unless File.exists?(x64)
cp 'cpp\\prebuilt\\Win32\\Release\\IEDriver.dll', win32, :verbose => true
cp 'cpp\\prebuilt\\x64\\Release\\IEDriver.dll', x64, :verbose => true

sh "build\\python\\Scripts\\python setup.py build", :verbose => true

if File.exists?('build\\python\\Scripts\\py.test.exe')
py_test = 'build\\python\\Scripts\\py.test.exe'
else
Expand All @@ -342,7 +348,8 @@ task :test_ie_py => :webdriver_py do

test_dir = Dir.glob('build/lib**/selenium/test/selenium/webdriver/ie').first
sh py_test, test_dir, :verbose => true
rm "py\\selenium\\webdriver\\ie\\IEDriver.dll"
rm_rf win32
rm_rf x64
end
end
end
Expand Down Expand Up @@ -427,17 +434,22 @@ task :py_prep_for_install_release => ["//javascript/firefox-driver:webdriver", :
firefox_py_home = "py/selenium/webdriver/firefox/"
xpi_zip_build = 'build/javascript/firefox-driver/webdriver.xpi'

ie_driver = 'cpp/prebuilt/Win32/Release/IEDriver.dll'
ie_py_home = "py/selenium/webdriver/ie"
ie_driver_32 = 'cpp/prebuilt/Win32/Release/IEDriver.dll'
ie_driver_64 = 'cpp/prebuilt/x64/Release/IEDriver.dll'
ie_py_home = "py/selenium/webdriver/ie/"
if (windows?) then
xpi_zip_build = xpi_zip_build.gsub(/\//, "\\")
firefox_py_home = firefox_py_home .gsub(/\//, "\\")
ie_driver = ie_driver.gsub(/\//, "\\")
ie_driver_32 = ie_driver_32.gsub(/\//, "\\")
ie_driver_64 = ie_driver_64.gsub(/\//, "\\")
ie_py_home = ie_py_home.gsub(/\//, "\\")
end

mkdir_p ie_py_home + "win32" unless File.exists?(ie_py_home + "win32")
mkdir_p ie_py_home + "x64" unless File.exists?(ie_py_home + "x64")
cp xpi_zip_build , firefox_py_home, :verbose => true
cp ie_driver, ie_py_home, :verbose => true
cp ie_driver_32, ie_py_home + "win32", :verbose => true
cp ie_driver_64, ie_py_home + "x64", :verbose => true
end
end

Expand Down
1 change: 1 addition & 0 deletions py/CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Selenium 2.4
* Bug Fixes
* x64 IE Support

Selenium 2.3
* Bug Fixes
Expand Down
9 changes: 8 additions & 1 deletion py/selenium/webdriver/ie/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from selenium.webdriver.remote.webdriver import WebDriver as RemoteWebDriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.remote.command import Command
from selenium.common.exceptions import WebDriverException
from ctypes import *
import time
import os
Expand All @@ -35,7 +36,13 @@ def __init__(self, port=DEFAULT_PORT, timeout=DEFAULT_TIMEOUT):
self.port = utils.free_port()

# Create IE Driver instance of the unmanaged code
self.iedriver = CDLL(os.path.join(os.path.dirname(__file__), "IEDriver.dll"))
try:
self.iedriver = CDLL(os.path.join(os.path.dirname(__file__),"win32", "IEDriver.dll"))
except WindowsError:
try:
self.iedriver = CDLL(os.path.join(os.path.dirname(__file__),"x64", "IEDriver.dll"))
except WindowsError:
raise WebDriverException("Unable to load the IEDriver.dll component")
self.ptr = self.iedriver.StartServer(self.port)

seconds = 0
Expand Down

0 comments on commit 4d043cd

Please sign in to comment.