Skip to content

Commit fa63c55

Browse files
authored
Merge pull request #712 from seleniumbase/handle-edge-case-with-file-downloads
Handle an edge case with multiple file downloads
2 parents 975d863 + ed5252a commit fa63c55

File tree

9 files changed

+42
-38
lines changed

9 files changed

+42
-38
lines changed

.github/Workflows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> SeleniumBase Workflows
1+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> SeleniumBase Workflows
22

33
> **Table of Contents / Navigation:**
44
> - [**CI build**](workflows/python-package.yml)

help_docs/customizing_test_runs.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

3-
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> CLI Options</h2>
3+
<h2><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> CLI Options</h2>
44

55
You can customize test runs from the command-line interface thanks to [SeleniumBase's pytest plugin](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py), which adds CLI options for setting/enabling the browser type, headless mode, mobile mode, multithreading mode, demo mode, proxy config, user agent config, browser extensions, and more.
66

@@ -156,14 +156,14 @@ Or the short form:
156156
sbase options
157157
```
158158

159-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Customizing default settings:
159+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Customizing default settings:
160160

161161
An easy way to override [seleniumbase/config/settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) is by using a custom settings file.
162162
Here's the command-line option to add to tests: (See [examples/custom_settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/custom_settings.py))
163163
``--settings-file=custom_settings.py``
164164
(Settings include default timeout values, a two-factor auth key, DB credentials, S3 credentials, and other important settings used by tests.)
165165

166-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Running tests on a remote Selenium Grid:
166+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Running tests on a remote Selenium Grid:
167167

168168
SeleniumBase lets you run tests on remote Selenium Grids such as [BrowserStack](https://www.browserstack.com/automate#)'s Selenium Grid, [Sauce Labs](https://saucelabs.com/products/open-source-frameworks/selenium)'s Selenium Grid, [TestingBot](https://testingbot.com/features)'s Selenium Grid, other Grids, and even your own Grid:
169169

@@ -196,15 +196,15 @@ pytest my_first_test.py --server=USERNAME:[email protected] --port=80
196196

197197
Or you can create your own Selenium Grid for test distribution. ([See this ReadMe for details](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md))
198198

199-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Example tests using Logging:
199+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Example tests using Logging:
200200

201201
```bash
202202
pytest test_suite.py --browser=chrome
203203
```
204204

205205
(During test failures, logs and screenshots from the most recent test run will get saved to the ``latest_logs/`` folder. Those logs will get moved to ``archived_logs/`` if you have ARCHIVE_EXISTING_LOGS set to True in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py), otherwise log files with be cleaned up at the start of the next test run.)
206206

207-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Demo Mode:
207+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Demo Mode:
208208

209209
If any test is moving too fast for your eyes to see what's going on, you can run it in **Demo Mode** by adding ``--demo`` on the command line, which pauses the browser briefly between actions, highlights page elements being acted on, and lets you know what test assertions are happening in real time:
210210

@@ -218,22 +218,22 @@ You can override the default wait time by either updating [settings.py](https://
218218
pytest my_first_test.py --demo --demo-sleep=1.2
219219
```
220220

221-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Passing additional data to tests:
221+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Passing additional data to tests:
222222

223223
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.
224224

225-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Running tests multithreaded:
225+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Running tests multithreaded:
226226

227227
To run Pytest multithreaded on multiple CPUs at the same time, add ``-n=NUM`` or ``-n NUM`` on the command line, where NUM is the number of CPUs you want to use.
228228

229-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Retrying failing tests automatically:
229+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Retrying failing tests automatically:
230230

231231
You can use ``--reruns=NUM`` to retry failing tests that many times. Use ``--reruns-delay=SECONDS`` to wait that many seconds between retries. Example:
232232
```
233233
pytest --reruns=2 --reruns-delay=1
234234
```
235235

236-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Debugging tests:
236+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Debugging tests:
237237

238238
You can use the following calls in your scripts to help you debug issues:
239239

@@ -251,7 +251,7 @@ pytest my_first_test.py --pdb -s
251251

252252
The code above will leave your browser window open in case there's a failure. (ipdb commands: 'c', 's', 'n' => continue, step, next).
253253

254-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Pytest Reports:
254+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Pytest Reports:
255255

256256
Using ``--html=report.html`` gives you a fancy report of the name specified after your test suite completes.
257257

@@ -260,7 +260,7 @@ pytest test_suite.py --html=report.html
260260
```
261261
<img src="https://cdn2.hubspot.net/hubfs/100006/images/pytest_report_3c.png" alt="Example Pytest Report" title="Example Pytest Report" width="520" />
262262

263-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Nosetest Reports:
263+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Nosetest Reports:
264264

265265
The ``--report`` option gives you a fancy report after your test suite completes.
266266

@@ -271,7 +271,7 @@ nosetests test_suite.py --report
271271

272272
(NOTE: You can add ``--show_report`` to immediately display Nosetest reports after the test suite completes. Only use ``--show_report`` when running tests locally because it pauses the test run.)
273273

274-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Using a Proxy Server:
274+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Using a Proxy Server:
275275

276276
If you wish to use a proxy server for your browser tests (Chrome and Firefox only), you can add ``--proxy=IP_ADDRESS:PORT`` as an argument on the command line.
277277

@@ -291,15 +291,15 @@ To make things easier, you can add your frequently-used proxies to PROXY_LIST in
291291
pytest proxy_test.py --proxy=proxy1
292292
```
293293

294-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Changing the User-Agent:
294+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Changing the User-Agent:
295295

296296
If you wish to change the User-Agent for your browser tests (Chrome and Firefox only), you can add ``--agent="USER-AGENT-STRING"`` as an argument on the command line.
297297

298298
```bash
299299
pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1.7412.EU"
300300
```
301301

302-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Mobile Device Testing:
302+
### <img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Mobile Device Testing:
303303

304304
Use ``--mobile`` to quickly run your tests using Chrome's mobile device emulator with default values for device metrics (CSS Width, CSS Height, Pixel-Ratio) and a default value set for the user agent. To configure the mobile device metrics, use ``--metrics="CSS_Width,CSS_Height,Pixel_Ratio"`` to set those values. You'll also be able to set the user agent with ``--agent="USER-AGENT-STRING"`` (a default user agent will be used if not specified). To find real values for device metrics, [see this GitHub Gist](https://gist.github.com/sidferreira/3f5fad525e99b395d8bd882ee0fd9d00). For a list of available user agent strings, [check out this page](https://developers.whatismybrowser.com/useragents/explore/).
305305

integrations/brython/ReadMe.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55

66
### 1. Get a web server up and running:
77

8+
<i>Run from [SeleniumBase/integrations/brython](https://github.com/seleniumbase/SeleniumBase/tree/master/integrations/brython)</i>:
9+
810
```bash
911
python -m http.server
1012
```
11-
(You can always stop the server by using ``CTRL-C``.)
13+
You can always stop the server by using ``CTRL-C``.
1214

1315
### 2. Navigate to [http://localhost:8000/](http://localhost:8000/)
1416

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edit_uri: ""
1010
site_dir: "site"
1111
docs_dir: "docs"
1212
# Copyright
13-
copyright: Copyright &copy; 2014 - 2020 Michael Mintz / SeleniumBase
13+
copyright: Copyright &copy; 2014 - 2021 Michael Mintz / SeleniumBase
1414
# Extensions
1515
markdown_extensions:
1616
- markdown.extensions.admonition

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ importlib-metadata==2.0.0
5858
virtualenv>=20.0.33
5959
pymysql==0.10.1
6060
coverage==5.3
61-
brython==3.8.10
61+
brython==3.9.0
6262
pyotp==2.4.0
6363
boto==2.49.0
6464
cffi==1.14.3

seleniumbase/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<img src="https://seleniumbase.io/cdn/img/sb_text_f.png" title="SeleniumBase" align="center" width="290">
22

3-
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="24" /> Framework Folders</h2>
3+
<h2><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Framework Folders</h2>
44

55
* <b>[fixtures](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/fixtures):</b> Includes [base_case.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py), where SeleniumBase test methods are defined.
66
* <b>[core](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/core):</b> Includes [browser_launcher.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/browser_launcher.py), which is used for spinning up browsers for tests.

seleniumbase/console_scripts/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[<img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" title="SeleniumBase" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

3-
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Console Scripts</h2>
3+
<h2><img src="https://seleniumbase.io/img/logo3a.png" title="SeleniumBase" width="28" /> Console Scripts</h2>
44

55
SeleniumBase console scripts help you get things done more easily, such as installing web drivers, creating a test directory with necessary configuration files, converting old WebDriver unittest scripts into SeleniumBase code, translating tests into multiple languages, and using the Selenium Grid.
66

seleniumbase/core/browser_launcher.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -144,15 +144,15 @@ def _set_chrome_options(
144144
"download.directory_upgrade": True,
145145
"safebrowsing.enabled": False,
146146
"safebrowsing.disable_download_protection": True,
147-
"profile": {
148-
"password_manager_enabled": False,
149-
"default_content_setting_values.automatic_downloads": 1,
150-
"managed_default_content_settings.automatic_downloads": 1,
151-
"default_content_settings.popups": 0,
152-
"managed_default_content_settings.popups": 0,
153-
"content_settings.exceptions.automatic_downloads.*.setting": 1,
154-
"content_settings.pattern_pairs.*.multiple-automatic-downloads": 1
155-
}
147+
"default_content_setting_values.notifications": 0,
148+
"default_content_settings.popups": 0,
149+
"managed_default_content_settings.popups": 0,
150+
"content_settings.exceptions.automatic_downloads.*.setting": 1,
151+
"profile.password_manager_enabled": False,
152+
"profile.default_content_setting_values.notifications": 0,
153+
"profile.default_content_settings.popups": 0,
154+
"profile.managed_default_content_settings.popups": 0,
155+
"profile.default_content_setting_values.automatic_downloads": 1
156156
}
157157
if locale_code:
158158
prefs["intl.accept_languages"] = locale_code
@@ -769,13 +769,15 @@ def get_local_driver(
769769
"download.directory_upgrade": True,
770770
"safebrowsing.enabled": False,
771771
"safebrowsing.disable_download_protection": True,
772-
"profile": {
773-
"password_manager_enabled": False,
774-
"default_content_setting_values.automatic_downloads": 1,
775-
"managed_default_content_settings.automatic_downloads": 1,
776-
"default_content_settings.popups": 0,
777-
"managed_default_content_settings.popups": 0
778-
}
772+
"default_content_setting_values.notifications": 0,
773+
"default_content_settings.popups": 0,
774+
"managed_default_content_settings.popups": 0,
775+
"content_settings.exceptions.automatic_downloads.*.setting": 1,
776+
"profile.password_manager_enabled": False,
777+
"profile.default_content_setting_values.notifications": 0,
778+
"profile.default_content_settings.popups": 0,
779+
"profile.managed_default_content_settings.popups": 0,
780+
"profile.default_content_setting_values.automatic_downloads": 1
779781
}
780782
if locale_code:
781783
prefs["intl.accept_languages"] = locale_code

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
setup(
5656
name='seleniumbase',
57-
version='1.49.24',
57+
version='1.49.25',
5858
description='A complete framework for Web-UI testing | seleniumbase.io',
5959
long_description=long_description,
6060
long_description_content_type='text/markdown',
@@ -152,7 +152,7 @@
152152
'virtualenv>=20.0.33', # Sync with importlib-metadata and pathlib2
153153
'pymysql==0.10.1',
154154
'coverage==5.3',
155-
'brython==3.8.10',
155+
'brython==3.9.0',
156156
'pyotp==2.4.0',
157157
'boto==2.49.0',
158158
'cffi==1.14.3',

0 commit comments

Comments
 (0)