Skip to content

Commit 72e13c6

Browse files
committed
Optimize settings for IE
1 parent bf3b05b commit 72e13c6

File tree

2 files changed

+17
-9
lines changed

2 files changed

+17
-9
lines changed

seleniumbase/core/browser_launcher.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -286,20 +286,22 @@ def get_local_driver(browser_name, headless, proxy_string):
286286
if not IS_WINDOWS:
287287
raise Exception(
288288
"IE Browser is for Windows-based operating systems only!")
289-
ie_caps = DesiredCapabilities.INTERNETEXPLORER.copy()
290-
ie_caps['ignoreProtectedModeSettings'] = True
291-
ie_caps['IntroduceInstabilityByIgnoringProtectedModeSettings'] = True
292-
ie_caps['nativeEvents'] = True
293-
ie_caps['ignoreZoomSetting'] = True
294-
ie_caps['requireWindowFocus'] = True
295-
ie_caps['INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS'] = True
289+
from selenium.webdriver.ie.options import Options
290+
ie_options = Options()
291+
ie_options.ignore_protected_mode_settings = True
292+
ie_options.ignore_zoom_level = True
293+
ie_options.require_window_focus = True
294+
ie_options.native_events = True
295+
ie_options.full_page_screenshot = True
296+
ie_options.persistent_hover = True
297+
ie_capabilities = ie_options.to_capabilities()
296298
if LOCAL_IEDRIVER and os.path.exists(LOCAL_IEDRIVER):
297299
make_driver_executable_if_not(LOCAL_IEDRIVER)
298300
return webdriver.Ie(
299-
capabilities=ie_caps,
301+
capabilities=ie_capabilities,
300302
executable_path=LOCAL_IEDRIVER)
301303
else:
302-
return webdriver.Ie(capabilities=ie_caps)
304+
return webdriver.Ie(capabilities=ie_capabilities)
303305
elif browser_name == constants.Browser.EDGE:
304306
if not IS_WINDOWS:
305307
raise Exception(

seleniumbase/fixtures/base_case.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,6 +1361,8 @@ def highlight(self, selector, by=By.CSS_SELECTOR,
13611361

13621362
if self.highlights:
13631363
loops = self.highlights
1364+
if self.browser == 'ie':
1365+
loops = 1 # Override previous setting because IE is slow
13641366
loops = int(loops)
13651367

13661368
o_bs = '' # original_box_shadow
@@ -2576,6 +2578,10 @@ def __scroll_to_element(self, element):
25762578
self.__demo_mode_pause_if_active(tiny=True)
25772579

25782580
def __slow_scroll_to_element(self, element):
2581+
if self.browser == 'ie':
2582+
# IE breaks on slow-scrolling. Do a fast scroll instead.
2583+
self.__scroll_to_element(element)
2584+
return
25792585
scroll_position = self.execute_script("return window.scrollY;")
25802586
element_location = element.location['y']
25812587
element_location = element_location - 130

0 commit comments

Comments
 (0)