Skip to content

Commit dea28f5

Browse files
committed
Fix IE browser launcher
1 parent d558b9a commit dea28f5

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,20 @@
1313
from seleniumbase import drivers # webdriver storage folder for SeleniumBase
1414
DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
1515
PLATFORM = sys.platform
16+
IS_WINDOWS = False
1617
LOCAL_CHROMEDRIVER = None
1718
LOCAL_GECKODRIVER = None
1819
LOCAL_EDGEDRIVER = None
20+
LOCAL_IEDRIVER = None
1921
LOCAL_OPERADRIVER = None
2022
if "darwin" in PLATFORM or "linux" in PLATFORM:
2123
LOCAL_CHROMEDRIVER = DRIVER_DIR + '/chromedriver'
2224
LOCAL_GECKODRIVER = DRIVER_DIR + '/geckodriver'
2325
LOCAL_OPERADRIVER = DRIVER_DIR + '/operadriver'
2426
elif "win32" in PLATFORM or "win64" in PLATFORM or "x64" in PLATFORM:
27+
IS_WINDOWS = True
2528
LOCAL_EDGEDRIVER = DRIVER_DIR + '/MicrosoftWebDriver.exe'
29+
LOCAL_IEDRIVER = DRIVER_DIR + '/IEDriverServer.exe'
2630
LOCAL_CHROMEDRIVER = DRIVER_DIR + '/chromedriver.exe'
2731
LOCAL_GECKODRIVER = DRIVER_DIR + '/geckodriver.exe'
2832
LOCAL_OPERADRIVER = DRIVER_DIR + '/operadriver.exe'
@@ -279,8 +283,21 @@ def get_local_driver(browser_name, headless, proxy_string):
279283
raise Exception(e)
280284
return webdriver.Firefox()
281285
elif browser_name == constants.Browser.INTERNET_EXPLORER:
282-
return webdriver.Ie()
286+
if not IS_WINDOWS:
287+
raise Exception(
288+
"IE Browser is for Windows-based operating systems only!")
289+
ie_capabilities = DesiredCapabilities.INTERNETEXPLORER.copy()
290+
if LOCAL_IEDRIVER and os.path.exists(LOCAL_IEDRIVER):
291+
make_driver_executable_if_not(LOCAL_IEDRIVER)
292+
return webdriver.Ie(
293+
capabilities=ie_capabilities,
294+
executable_path=LOCAL_IEDRIVER)
295+
else:
296+
return webdriver.Ie(capabilities=ie_capabilities)
283297
elif browser_name == constants.Browser.EDGE:
298+
if not IS_WINDOWS:
299+
raise Exception(
300+
"Edge Browser is for Windows-based operating systems only!")
284301
edge_capabilities = DesiredCapabilities.EDGE.copy()
285302
if LOCAL_EDGEDRIVER and os.path.exists(LOCAL_EDGEDRIVER):
286303
make_driver_executable_if_not(LOCAL_EDGEDRIVER)

0 commit comments

Comments
 (0)