Skip to content

Commit dd7152d

Browse files
authored
Merge pull request #190 from seleniumbase/ie-optimization
Internet Explorer optimization
2 parents bf3b05b + 4a77d3b commit dd7152d

File tree

4 files changed

+25
-17
lines changed

4 files changed

+25
-17
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
SeleniumBase extends [WebDriver](https://docs.microsoft.com/en-us/microsoft-edge/webdriver) into a complete framework for end-to-end testing with [Pytest](https://github.com/pytest-dev/pytest).
66

7-
## Quick Start
7+
## ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") Quick Start
88

99
(Requires [Python](https://www.python.org/downloads/), [Git](https://git-scm.com/), and an optional [Python virtual environment](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md).)
1010

@@ -52,7 +52,7 @@ pytest google_tour.py
5252

5353
For more detailed steps on getting started, see the [**Detailed Instructions**](#seleniumbase_installation) section.
5454

55-
### Learn More:
55+
### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") Learn More:
5656

5757
#### **No more repetitive WebDriver code:**<br />
5858
SeleniumBase automatically handles common WebDriver actions such as spinning up web browsers, waiting for page objects to load, saving screenshots during test failures, using a proxy server, and more. (<i>[Read about customizing test runs](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md).</i>)
@@ -104,9 +104,9 @@ To learn about businesses using SeleniumBase, [Click Here](https://github.com/se
104104
To see a full list of SeleniumBase features, [Click Here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/features_list.md).
105105

106106
<a id="seleniumbase_installation"></a>
107-
<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo3g4.png" title="SeleniumBase" height="45">
107+
<img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="100">
108108

109-
## Detailed Instructions:
109+
## ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") Detailed Instructions:
110110

111111
Before installation, **[install Python](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/install_python_pip_git.md)** and **[install a web driver](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/webdriver_installation.md)**.
112112

@@ -237,7 +237,7 @@ To run Pytest multithreaded on multiple CPUs at the same time, add ``-n=NUM`` or
237237

238238
If you want to pass additional data from the command line to your tests, you can use ``--data=STRING``. Now inside your tests, you can use ``self.data`` to access that.
239239

240-
<img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="120">
240+
<img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="100">
241241

242242
### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") **Using SeleniumBase as your personal framework:**
243243

@@ -276,7 +276,7 @@ cd browser_tests
276276
pytest my_first_test.py --browser=chrome
277277
```
278278

279-
<img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="120">
279+
<img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="100">
280280

281281
<a id="creating_visual_reports"></a>
282282
### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") **Creating Visual Test Suite Reports:**
@@ -389,7 +389,7 @@ pytest test_fail.py
389389
You'll notice that a logs folder, "latest_logs", was created to hold information about the failing test, and screenshots. Take a look at what you get. Remember, this data can be saved in your MySQL DB and in S3 if you include the necessary plugins in your run command (and if you set up the neccessary connections properly). For future test runs, past test results will get stored in the archived_logs folder if you have ARCHIVE_EXISTING_LOGS set to True in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py).
390390

391391

392-
<img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="120">
392+
<img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="100">
393393

394394
<a id="detailed_method_specifications"></a>
395395
### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") **Detailed Method Specifications and Examples:**

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 = False
292+
ie_options.ignore_zoom_level = True
293+
ie_options.require_window_focus = False
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

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setup(
99
name='seleniumbase',
10-
version='1.14.1',
10+
version='1.14.2',
1111
description='Web Automation & Testing Framework - http://seleniumbase.com',
1212
long_description='Web Automation and Testing Framework - seleniumbase.com',
1313
platforms='Mac * Windows * Linux * Docker',

0 commit comments

Comments
 (0)