|
13 | 13 | from seleniumbase import drivers # webdriver storage folder for SeleniumBase
|
14 | 14 | DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
|
15 | 15 | PLATFORM = sys.platform
|
| 16 | +IS_WINDOWS = False |
16 | 17 | LOCAL_CHROMEDRIVER = None
|
17 | 18 | LOCAL_GECKODRIVER = None
|
18 | 19 | LOCAL_EDGEDRIVER = None
|
| 20 | +LOCAL_IEDRIVER = None |
19 | 21 | LOCAL_OPERADRIVER = None
|
20 | 22 | if "darwin" in PLATFORM or "linux" in PLATFORM:
|
21 | 23 | LOCAL_CHROMEDRIVER = DRIVER_DIR + '/chromedriver'
|
22 | 24 | LOCAL_GECKODRIVER = DRIVER_DIR + '/geckodriver'
|
23 | 25 | LOCAL_OPERADRIVER = DRIVER_DIR + '/operadriver'
|
24 | 26 | elif "win32" in PLATFORM or "win64" in PLATFORM or "x64" in PLATFORM:
|
| 27 | + IS_WINDOWS = True |
25 | 28 | LOCAL_EDGEDRIVER = DRIVER_DIR + '/MicrosoftWebDriver.exe'
|
| 29 | + LOCAL_IEDRIVER = DRIVER_DIR + '/IEDriverServer.exe' |
26 | 30 | LOCAL_CHROMEDRIVER = DRIVER_DIR + '/chromedriver.exe'
|
27 | 31 | LOCAL_GECKODRIVER = DRIVER_DIR + '/geckodriver.exe'
|
28 | 32 | LOCAL_OPERADRIVER = DRIVER_DIR + '/operadriver.exe'
|
@@ -279,8 +283,21 @@ def get_local_driver(browser_name, headless, proxy_string):
|
279 | 283 | raise Exception(e)
|
280 | 284 | return webdriver.Firefox()
|
281 | 285 | 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) |
283 | 297 | elif browser_name == constants.Browser.EDGE:
|
| 298 | + if not IS_WINDOWS: |
| 299 | + raise Exception( |
| 300 | + "Edge Browser is for Windows-based operating systems only!") |
284 | 301 | edge_capabilities = DesiredCapabilities.EDGE.copy()
|
285 | 302 | if LOCAL_EDGEDRIVER and os.path.exists(LOCAL_EDGEDRIVER):
|
286 | 303 | make_driver_executable_if_not(LOCAL_EDGEDRIVER)
|
|
0 commit comments