Skip to content

Commit 5fe17f5

Browse files
authored
Merge pull request #710 from seleniumbase/allow-multiple-downloads-without-prompts
Allow multiple file downloads without prompts
2 parents 9911e6f + f297b8c commit 5fe17f5

File tree

10 files changed

+118
-77
lines changed

10 files changed

+118
-77
lines changed

README.md

Lines changed: 72 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@ Tests are run with <code><b>pytest</b></code>. Browsers are controlled by WebDri
5858
<p align="center"><img src="https://cdn2.hubspot.net/hubfs/100006/images/swag_labs_gif.gif" alt="SeleniumBase" title="SeleniumBase" /></p>
5959

6060
<a id="python_installation"></a>
61-
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Start 🚀:</h2>
61+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Start: 🚀</h2>
6262

63-
* Get **[Python](https://www.python.org/downloads/)** and **[Git](https://git-scm.com/)**
63+
* Add **[Python](https://www.python.org/downloads/)** and **[Git](https://git-scm.com/)** to your System PATH.
6464

65-
Upgrade <b>[pip](https://pypi.org/project/pip/)</b> and create a [Python virtual environment](https://seleniumbase.io/help_docs/virtualenv_instructions/):
65+
* Upgrade <b>[pip](https://pypi.org/project/pip/)</b> and create a [Python virtual env](https://seleniumbase.io/help_docs/virtualenv_instructions/):
6666

67-
* macOS/Linux:
67+
> macOS/Linux (terminal):
6868
6969
```bash
7070
python3 -m pip install -U pip
7171
python3 -m venv sbase_env
7272
source sbase_env/bin/activate
7373
```
7474

75-
* Windows(Cmd):
75+
> Windows (CMD prompt):
7676
7777
```bash
7878
py -m pip install -U pip
@@ -83,35 +83,78 @@ call sbase_env\\Scripts\\activate
8383
<a id="install_seleniumbase"></a>
8484
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Install SeleniumBase:</h2>
8585

86-
You can install ``seleniumbase`` from [pypi](https://pypi.python.org/pypi/seleniumbase):
86+
* You can install ``seleniumbase`` from [pypi](https://pypi.python.org/pypi/seleniumbase):
8787

8888
```bash
8989
pip install seleniumbase
9090
```
9191

92-
* Add ``--upgrade`` OR ``-U`` to upgrade an installation.
93-
* Add ``--force-reinstall`` to also upgrade dependencies.
92+
> (Add ``--upgrade`` OR ``-U`` to upgrade an installation.)
93+
> (Add ``--force-reinstall`` to upgrade dependencies.)
9494
95-
You can also install SeleniumBase from a [GitHub](https://github.com/seleniumbase/SeleniumBase) clone:
95+
* You can also install SeleniumBase from a [GitHub](https://github.com/seleniumbase/SeleniumBase) clone:
9696

9797
```bash
9898
git clone https://github.com/seleniumbase/SeleniumBase.git
9999
cd SeleniumBase/
100100
pip install .
101101
```
102102

103+
* Type ``seleniumbase`` or ``sbase`` to verify that SeleniumBase was installed successfully:
104+
105+
```bash
106+
______ __ _ ____
107+
/ ____/__ / /__ ____ (_)_ ______ ___ / _ \____ ________
108+
\__ \/ _ \/ / _ \/ __ \/ / / / / __ `__ \/ /_) / __ \/ ___/ _ \
109+
___/ / __/ / __/ / / / / /_/ / / / / / / /_) / (_/ /__ / __/
110+
/____/\___/_/\___/_/ /_/_/\__,_/_/ /_/ /_/_____/\__,_/____/\___/
111+
112+
[seleniumbase <VERSION> (<PATH>)]
113+
114+
* USAGE: "seleniumbase [COMMAND] [PARAMETERS]"
115+
* OR: "sbase [COMMAND] [PARAMETERS]"
116+
117+
COMMANDS:
118+
install [DRIVER] [OPTIONS]
119+
mkdir [DIRECTORY]
120+
mkfile [FILE.py]
121+
options (List common pytest options)
122+
print [FILE] [OPTIONS]
123+
translate [SB_FILE.py] [LANG] [ACTION]
124+
convert [WEBDRIVER_UNITTEST_FILE.py]
125+
extract-objects [SB_FILE.py]
126+
inject-objects [SB_FILE.py] [OPTIONS]
127+
objectify [SB_FILE.py] [OPTIONS]
128+
revert-objects [SB_FILE.py]
129+
encrypt (OR: obfuscate)
130+
decrypt (OR: unobfuscate)
131+
download server (Selenium Server JAR file)
132+
grid-hub [start|stop] [OPTIONS]
133+
grid-node [start|stop] --hub=[HOST/IP]
134+
* (EXAMPLE: "sbase install chromedriver latest") *
135+
136+
Type "sbase help [COMMAND]" for specific command info.
137+
For info on all commands, type: "seleniumbase --help".
138+
* (Use "pytest" for running tests) *
139+
```
140+
103141
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Download a webdriver:</h3>
104142
105143
SeleniumBase can download webdrivers to the [seleniumbase/drivers](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/drivers) folder with the ``install`` command:
144+
106145
```bash
107146
sbase install chromedriver
108147
```
109-
* You need a different webdriver for each browser: ``chromedriver`` for Chrome, ``edgedriver`` for Edge, ``geckodriver`` for Firefox, and ``operadriver`` for Opera.
148+
149+
* You need a different webdriver for each browser to automate: ``chromedriver`` for Chrome, ``edgedriver`` for Edge, ``geckodriver`` for Firefox, and ``operadriver`` for Opera.
110150
* If you have the latest version of Chrome installed, get the latest chromedriver (<i>otherwise it defaults to chromedriver 2.44 for compatibility reasons</i>):
151+
111152
```bash
112153
sbase install chromedriver latest
113154
```
114155
156+
* If you run a test without the correct webdriver installed, the driver will be downloaded automatically.
157+
115158
(See [seleniumbase.io/seleniumbase/console_scripts/ReadMe/](https://seleniumbase.io/seleniumbase/console_scripts/ReadMe/) for more information on SeleniumBase console scripts.)
116159
117160
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Create and run tests:</h3>
@@ -123,7 +166,20 @@ sbase mkdir ui_tests
123166
cd ui_tests/
124167
```
125168
126-
* Now run a sample test with ``pytest``:
169+
> This folder contains the following files:
170+
171+
```
172+
__init__.py
173+
boilerplates/
174+
my_first_test.py
175+
parameterized_test.py
176+
pytest.ini
177+
requirements.txt
178+
setup.cfg
179+
test_demo_site.py
180+
```
181+
182+
* <b>Run a sample test with ``pytest``:</b>
127183
128184
```bash
129185
pytest test_demo_site.py
@@ -259,31 +315,6 @@ For a full list of SeleniumBase features, <a href="https://github.com/seleniumba
259315
260316
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Detailed Instructions:</h2>
261317
262-
<h4><b>Here's how to run the example script on various web browsers:</b></h4>
263-
264-
First install a webdriver for each browser you intend to use:
265-
266-
```bash
267-
seleniumbase install chromedriver
268-
seleniumbase install geckodriver
269-
seleniumbase install edgedriver
270-
seleniumbase install iedriver
271-
seleniumbase install operadriver
272-
```
273-
274-
Next, choose between ``pytest`` and ``nosetests`` test runners. (<i>Mostly interchangeable.</i>)
275-
276-
```bash
277-
cd examples/
278-
279-
pytest my_first_test.py --browser=chrome
280-
281-
nosetests my_first_test.py --browser=firefox
282-
```
283-
284-
(<i>If no browser is specified, Chrome is used by default.</i>)
285-
With Pytest, a green dot means a test passed. An "F" means a test failed.
286-
287318
<a id="seleniumbase_demo_mode"></a> <b>Use Demo Mode to help you see what tests are asserting.</b>
288319
289320
If the example test is moving too fast for your eyes, 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:
@@ -404,7 +435,7 @@ Here's the command-line option to add to tests: (See [examples/custom_settings.p
404435
(Settings include default timeout values, a two-factor auth key, DB credentials, S3 credentials, and other important settings used by tests.)
405436
406437
To pass additional data from the command-line to tests, add ``--data="ANY STRING"``.
407-
Now inside your tests, you can use ``self.data`` to access that.
438+
Inside your tests, you can use ``self.data`` to access that.
408439
409440
410441
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Test Directory Customization:</h3>
@@ -524,22 +555,22 @@ Learn about <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/ex
524555
<a id="utilizing_advanced_features"></a>
525556
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Production Environments & Integrations:</h3>
526557
527-
Here are some things you can do to setup a production environment for your testing:
558+
Here are some things you can do to set up a production environment for your testing:
528559
529-
* You can setup a [Jenkins](https://jenkins.io/) build server for running tests at regular intervals. For a real-world Jenkins example of headless browser automation in action, check out the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/jenkins/ReadMe.md">SeleniumBase Jenkins example on Azure</a> or the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/google_cloud/ReadMe.md">SeleniumBase Jenkins example on Google Cloud</a>.
560+
* You can set up a [Jenkins](https://jenkins.io/) build server for running tests at regular intervals. For a real-world Jenkins example of headless browser automation in action, check out the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/jenkins/ReadMe.md">SeleniumBase Jenkins example on Azure</a> or the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/google_cloud/ReadMe.md">SeleniumBase Jenkins example on Google Cloud</a>.
530561
531562
* You can use [the Selenium Grid](https://selenium.dev/documentation/en/grid/) to scale your testing by distributing tests on several machines with parallel execution. To do this, check out the [SeleniumBase selenium_grid folder](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/utilities/selenium_grid), which should have everything you need, including the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md">Selenium Grid ReadMe</a>, which will help you get started.
532563
533564
* If you're using the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mysql_installation.md">SeleniumBase MySQL feature</a> to save results from tests running on a server machine, you can install [MySQL Workbench](https://dev.mysql.com/downloads/tools/workbench/) to help you read & write from your DB more easily.
534565
535566
* If you use [Slack](https://slack.com), you can easily have your Jenkins jobs display results there by using the [Jenkins Slack Plugin](https://github.com/jenkinsci/slack-plugin). Another way to send messages from your tests to Slack is by using [Slack's Incoming Webhooks API](https://api.slack.com/incoming-webhooks).
536567
537-
* If you're using AWS, you can setup an [Amazon S3](https://aws.amazon.com/s3/) account for saving log files and screenshots from your tests. To activate this feature, modify [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) with connection details in the S3 section, and add "``--with-s3-logging``" on the command-line when running your tests.
568+
* If you're using AWS, you can set up an [Amazon S3](https://aws.amazon.com/s3/) account for saving log files and screenshots from your tests. To activate this feature, modify [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) with connection details in the S3 section, and add "``--with-s3-logging``" on the command-line when running your tests.
538569
539570
Here's an example of running tests with additional features enabled:
540571
541572
```bash
542-
pytest [YOUR_TEST_FILE].py --with-db-reporting --with-s3-logging
573+
pytest [YOUR_TEST_FILE.py] --with-db-reporting --with-s3-logging
543574
```
544575
545576
<a id="detailed_method_specifications"></a>

examples/translations/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h3 align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_m.png" title="SeleniumBase" width="290" /></a></h3>
1+
<h3 align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/super_logo_m.png" title="SeleniumBase" width="290" /></a></h3>
22

33
<a id="language_tests"></a>
44
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Language Tests (Python 3+)</h3>

help_docs/mobile_testing.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,4 @@ pytest test_swag_labs.py --mobile --agent="Mozilla/5.0 (Linux; Android 9; Pixel
4848
--------
4949

5050
<p align="center"><div align="center"><a href="https://seleniumbase.io">
51-
<img src="https://img.shields.io/badge/docs-%20📓📖📚-11BBDD.svg" alt="SeleniumBase.io Docs" />
52-
</a> <a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://img.shields.io/badge/✅%20💛%20View%20Code-on%20GitHub%20🌎%20🚀-02A79E.svg" alt="SeleniumBase.io Docs" /></a></div></p>
51+
<img src="https://img.shields.io/badge/docs-%20seleniumbase.io-11BBDD.svg" alt="SeleniumBase.io Docs" /></a> <a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://img.shields.io/badge/✅%20💛%20View%20Code-on%20GitHub%20🌎%20🚀-02A79E.svg" alt="SeleniumBase.io Docs" /></a></div></p>

help_docs/translations.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h3 align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_m.png" title="SeleniumBase" width="290" /></a></h3>
1+
<h3 align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/super_logo_m.png" title="SeleniumBase" width="290" /></a></h3>
22

33
<a id="language_tests"></a>
44
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Language Tests (Python 3+)</h3>

seleniumbase/config/proxy_list.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
"""
2121

2222
PROXY_LIST = {
23-
"example1": "46.28.229.75:3128", # (Example) - set your own proxy here
24-
"example2": "82.200.233.4:3128", # (Example) - set your own proxy here
25-
"example3": "128.199.214.87:3128", # (Example) - set your own proxy here
23+
"example1": "45.133.182.18:18080", # (Example) - set your own proxy here
24+
"example2": "95.174.67.50:18080", # (Example) - set your own proxy here
25+
"example3": "83.97.23.90:18080", # (Example) - set your own proxy here
26+
"example4": "82.200.233.4:3128", # (Example) - set your own proxy here
2627
"proxy1": None,
2728
"proxy2": None,
2829
"proxy3": None,

seleniumbase/console_scripts/ReadMe.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,6 @@ is included.
8787
Displays common pytest command-line options
8888
that are available when using SeleniumBase.
8989

90-
### convert
91-
92-
* Usage:
93-
``sbase convert [WEBDRIVER_UNITTEST_FILE.py]``
94-
95-
* Output:
96-
Converts a Selenium IDE exported WebDriver unittest file
97-
into a SeleniumBase file. Adds ``_SB`` to the new
98-
file name while keeping the original file intact.
99-
Works with Katalon Recorder scripts.
100-
See: http://www.katalon.com/automation-recorder
101-
10290
### print
10391

10492
* Usage:
@@ -142,6 +130,17 @@ plus the 2-letter language code of the new language.
142130
(Example: Translating "test_1.py" into Japanese with
143131
``-c`` will create a new file called "test_1_ja.py".)
144132

133+
### convert
134+
135+
* Usage:
136+
``sbase convert [WEBDRIVER_UNITTEST_FILE.py]``
137+
138+
* Output:
139+
Converts a Selenium IDE exported WebDriver unittest file
140+
into a SeleniumBase file. Adds ``_SB`` to the new
141+
file name while keeping the original file intact.
142+
Works with Katalon Recorder scripts.
143+
See: http://www.katalon.com/automation-recorder
145144

146145
### extract-objects
147146

seleniumbase/console_scripts/run.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def show_basic_usage():
6464
sc += (" mkdir [DIRECTORY]\n")
6565
sc += (" mkfile [FILE.py]\n")
6666
sc += (" options (List common pytest options)\n")
67-
sc += (" convert [WEBDRIVER_UNITTEST_FILE.py]\n")
6867
sc += (" print [FILE] [OPTIONS]\n")
6968
sc += (" translate [SB_FILE.py] [LANG] [ACTION]\n")
69+
sc += (" convert [WEBDRIVER_UNITTEST_FILE.py]\n")
7070
sc += (" extract-objects [SB_FILE.py]\n")
7171
sc += (" inject-objects [SB_FILE.py] [OPTIONS]\n")
7272
sc += (" objectify [SB_FILE.py] [OPTIONS]\n")
@@ -107,10 +107,13 @@ def show_install_usage():
107107
print(" Example:")
108108
print(" sbase install chromedriver")
109109
print(" sbase install geckodriver")
110-
print(" sbase install chromedriver 83.0.4103.39")
110+
print(" sbase install edgedriver")
111+
print(" sbase install chromedriver 85")
112+
print(" sbase install chromedriver 85.0.4183.87")
111113
print(" sbase install chromedriver latest")
112114
print(" sbase install chromedriver -p")
113115
print(" sbase install chromedriver latest -p")
116+
print(" sbase install edgedriver 85.0.564.68")
114117
print(" Output:")
115118
print(" Installs the chosen webdriver to seleniumbase/drivers/")
116119
print(" (chromedriver is required for Chrome automation)")

seleniumbase/console_scripts/sb_install.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@
22
Installs the specified web driver.
33
44
Usage:
5-
seleniumbase install {chromedriver|geckodriver|edgedriver|
6-
iedriver|operadriver} [OPTIONS]
5+
sbase install {chromedriver|geckodriver|edgedriver|
6+
iedriver|operadriver} [OPTIONS]
77
Options:
88
VERSION Specify the version.
99
(Default chromedriver version = 2.44)
1010
Use "latest" for the latest version.
1111
-p OR --path Also copy the driver to /usr/local/bin
1212
Example:
13-
seleniumbase install chromedriver
14-
seleniumbase install geckodriver
15-
seleniumbase install edgedriver
16-
seleniumbase install edgedriver 84.0.522.61
17-
seleniumbase install chromedriver 84
18-
seleniumbase install chromedriver 84.0.4147.30
19-
seleniumbase install chromedriver latest
20-
seleniumbase install chromedriver -p
21-
seleniumbase install chromedriver latest -p
13+
sbase install chromedriver
14+
sbase install geckodriver
15+
sbase install edgedriver
16+
sbase install chromedriver 85.0.4183.87
17+
sbase install chromedriver 85
18+
sbase install chromedriver latest
19+
sbase install chromedriver -p
20+
sbase install chromedriver latest -p
21+
sbase install edgedriver 85.0.564.68
2222
Output:
2323
Installs the chosen webdriver to seleniumbase/drivers/
2424
(chromedriver is required for Chrome automation)
2525
(geckodriver is required for Firefox automation)
2626
(edgedriver is required for MS Edge automation)
27-
(iedriver is required for Internet Explorer automation)
2827
(operadriver is required for Opera Browser automation)
28+
(iedriver is required for Internet Explorer automation)
2929
"""
3030

3131
import colorama

seleniumbase/core/browser_launcher.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,12 @@ def _set_chrome_options(
146146
"safebrowsing.disable_download_protection": True,
147147
"profile": {
148148
"password_manager_enabled": False,
149-
"default_content_setting_values.automatic_downloads": 1
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
150155
}
151156
}
152157
if locale_code:
@@ -766,7 +771,10 @@ def get_local_driver(
766771
"safebrowsing.disable_download_protection": True,
767772
"profile": {
768773
"password_manager_enabled": False,
769-
"default_content_setting_values.automatic_downloads": 1
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
770778
}
771779
}
772780
if locale_code:

setup.py

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

5555
setup(
5656
name='seleniumbase',
57-
version='1.49.22',
57+
version='1.49.23',
5858
description='A complete framework for Web-UI testing | seleniumbase.io',
5959
long_description=long_description,
6060
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)