Skip to content

Commit b93af1c

Browse files
authored
Merge pull request #360 from seleniumbase/requirements-update
Update the requirements
2 parents 181bef9 + de8dfef commit b93af1c

File tree

5 files changed

+64
-48
lines changed

5 files changed

+64
-48
lines changed

README.md

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
1-
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/sb_media_logo_bold.png" title="SeleniumBase" height="165">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
1+
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/sb_media_logo.png" title="SeleniumBase" height="129">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)<br />
2+
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo4d4.png" title="SeleniumBase" height="56">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
23

34
[<img src="https://img.shields.io/github/release/seleniumbase/SeleniumBase.svg" />](https://github.com/seleniumbase/SeleniumBase/releases) [<img src="https://dev.azure.com/seleniumbase/seleniumbase/_apis/build/status/seleniumbase.SeleniumBase?branchName=master" />](https://dev.azure.com/seleniumbase/seleniumbase/_build/latest?definitionId=1&branchName=master) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt="Build Status" />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt="Join the SeleniumBase Gitter chat" />](https://gitter.im/seleniumbase/SeleniumBase) [<img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" alt="MIT License" />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt="Stars" />](https://github.com/seleniumbase/SeleniumBase/stargazers) [<img src="https://img.shields.io/github/repo-size/seleniumbase/seleniumbase.svg" alt="Size" />](https://github.com/seleniumbase/SeleniumBase/releases)<br />
45

5-
Everything you need for automating Web/UI testing.
6+
Everything you need for testing web apps!
67

78
<img src="https://cdn2.hubspot.net/hubfs/100006/images/new_demo_gif.gif" title="SeleniumBase" height="225"><br />
89
(<i>Above: [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) from [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) running in demo mode, which adds JavaScript for highlighting page actions.</i>)<br />
9-
```
10+
```bash
1011
pytest my_first_test.py --demo_mode
1112
```
1213

1314
SeleniumBase is an all-in-one test automation framework that uses WebDriver APIs for spinning up web browsers while using pytest and nosetests for running tests.
1415

1516
## <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Quick Start:
1617

17-
You'll need **[Python](https://www.python.org/downloads/)** [<img src="https://img.shields.io/badge/python-2.7,_3.5,_3.6,_3.7-22AADD.svg" alt="Python versions" />](https://www.python.org/downloads/)
18+
You'll need **[Python](https://www.python.org/downloads/)** [<img src="https://img.shields.io/badge/python-2.7,_3.5,_3.6,_3.7+-22AADD.svg" alt="Python versions" />](https://www.python.org/downloads/)
1819

1920
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Install/upgrade ``pip``:
2021

2122
With Python installed and on your System PATH, you can get the latest ``pip`` with:
22-
```
23+
```bash
2324
python -m easy_install -U pip
2425
```
2526

@@ -28,14 +29,14 @@ python -m easy_install -U pip
2829
You may want to use a **Python Virtual Environment** to isolate Python dependencies between projects. (The Seleniumbase virtualenv tutorial can be found **[here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md)**, and the official virtualenv tutorial can be found **[here](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)**.)
2930

3031
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Install ``seleniumbase``: [<img src="https://img.shields.io/badge/pypi-seleniumbase-22AAEE.svg" alt="pypi" />](https://pypi.python.org/pypi/seleniumbase)
31-
```
32+
```bash
3233
pip install seleniumbase
3334
```
3435
* Add ``--upgrade`` to upgrade an existing installation.
3536
* Add ``--force-reinstall`` for a clean install.
3637

3738
You can also install SeleniumBase from a ``git clone``:
38-
```
39+
```bash
3940
git clone https://github.com/seleniumbase/SeleniumBase.git
4041
cd SeleniumBase
4142
pip install -r requirements.txt
@@ -44,20 +45,20 @@ python setup.py develop
4445
* "``pip install -e .``" also works from the top-level SeleniumBase folder.
4546

4647
You can also install a specific GitHub branch of SeleniumBase:
47-
```
48+
```bash
4849
pip install git+https://github.com/seleniumbase/SeleniumBase.git@master#egg=seleniumbase
4950
```
5051

5152
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Download a web driver:
5253

5354
SeleniumBase can download a web driver to the [seleniumbase/drivers](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/drivers) folder with the ``install`` command:
54-
```
55+
```bash
5556
seleniumbase install chromedriver
5657
```
5758
* You need a different web driver for each web browser you want to run automation on: ``chromedriver`` for Chrome, ``edgedriver`` for Edge, ``geckodriver`` for Firefox, ``operadriver`` for Opera, and ``iedriver`` for Internet Explorer.
5859

5960
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Run a test on Chrome:
60-
```
61+
```bash
6162
cd examples
6263
pytest my_first_test.py --browser=chrome
6364
```
@@ -85,7 +86,7 @@ self.driver.find_element_by_css_selector("textarea").send_keys("text")
8586

8687
#### **Run tests with ``pytest`` or ``nose`` in any browser:**<br />
8788
(<i>Using **pytest** is strongly recommended</i>)
88-
```
89+
```bash
8990
pytest my_first_test.py --browser=chrome
9091

9192
nosetests test_suite.py --browser=firefox
@@ -110,7 +111,7 @@ For a full list of SeleniumBase features, [Click Here](https://github.com/seleni
110111
**Here's how to run the example script on various web browsers:**
111112

112113
First, install a web driver for each web browser you intend to use:
113-
```
114+
```bash
114115
seleniumbase install chromedriver
115116
seleniumbase install geckodriver
116117
seleniumbase install edgedriver
@@ -119,7 +120,7 @@ seleniumbase install operadriver
119120
```
120121

121122
Next, choose between **pytest** and **nosetests** test runners. (<i>Interchangeable</i>)
122-
```
123+
```bash
123124
cd examples/
124125

125126
pytest my_first_test.py --browser=chrome
@@ -132,7 +133,7 @@ nosetests my_first_test.py --browser=firefox
132133

133134
If the example test is moving too fast for your eyes, you can run it in **Demo Mode** by adding ``--demo_mode`` 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:
134135

135-
```
136+
```bash
136137
pytest my_first_test.py --demo_mode
137138
```
138139

@@ -152,18 +153,20 @@ pytest my_first_test.py --browser=chrome --pdb -s
152153

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

155-
Here are some other useful **nosetest**-specific arguments:
156-
156+
Here are some other useful arguments:
157+
```bash
158+
-v # Prints the full test name rather than a dot for each test.
159+
-x # Stop running the tests after the first failure is reached.
157160
```
161+
162+
Here's a **nosetests**-specific argument:
163+
```bash
158164
--logging-level=INFO # Hide DEBUG messages, which can be overwhelming.
159-
-x # Stop running the tests after the first failure is reached.
160-
-v # Prints the full test name rather than a dot for each test.
161-
--with-id # If -v is also used, will number the tests for easy counting.
162165
```
163166

164167
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. The ``test_suite.py`` collection contains tests that fail on purpose so that you can see how logging works.
165168

166-
```
169+
```bash
167170
cd examples/
168171

169172
pytest test_suite.py --browser=chrome
@@ -183,7 +186,7 @@ For running tests outside of the SeleniumBase repo with **Pytest**, you'll want
183186

184187
As a shortcut, you'll be able to run ``seleniumbase mkdir [DIRECTORY_NAME]`` to create a new folder that already contains necessary files and some example tests that you can run. Example:
185188

186-
```
189+
```bash
187190
seleniumbase mkdir browser_tests
188191
cd browser_tests
189192
pytest my_first_test.py --browser=chrome
@@ -198,23 +201,23 @@ pytest my_first_test.py --browser=chrome
198201

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

201-
```
204+
```bash
202205
pytest test_suite.py --html=report.html
203206
```
204207

205208
![](https://cdn2.hubspot.net/hubfs/100006/images/PytestReport.png "Example Pytest Report")
206209

207210
You can also use ``--junit-xml=report.xml`` to get an xml report instead. Jenkins can use this file to display better reporting for your tests.
208211

209-
```
212+
```bash
210213
pytest test_suite.py --junit-xml=report.xml
211214
```
212215

213216
#### **Nosetest Reports:**
214217

215218
The ``--report`` option gives you a fancy report after your test suite completes.
216219

217-
```
220+
```bash
218221
nosetests test_suite.py --report
219222
```
220223
<img src="https://cdn2.hubspot.net/hubfs/100006/images/Test_Report_2.png" title="Example Nosetest Report" height="420">
@@ -226,19 +229,19 @@ nosetests test_suite.py --report
226229

227230
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.
228231

229-
```
232+
```bash
230233
pytest proxy_test.py --proxy=IP_ADDRESS:PORT
231234
```
232235

233236
If the proxy server that you wish to use requires authentication, you can do the following (Chrome only):
234237

235-
```
238+
```bash
236239
pytest proxy_test.py --proxy=USERNAME:PASSWORD@IP_ADDRESS:PORT
237240
```
238241

239242
To make things easier, you can add your frequently-used proxies to PROXY_LIST in [proxy_list.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/proxy_list.py), and then use ``--proxy=KEY_FROM_PROXY_LIST`` to use the IP_ADDRESS:PORT of that key.
240243

241-
```
244+
```bash
242245
pytest proxy_test.py --proxy=proxy1
243246
```
244247

@@ -268,7 +271,7 @@ Here are some things you can do to setup a production environment for your testi
268271

269272
* If you're using the [SeleniumBase MySQL feature](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mysql_installation.md) 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. You'll also need to install the MySQL Python client. Depending on your system, you may need to install additional requirements for this (such as on Windows). See [Stackoverflow](https://stackoverflow.com/questions/43102442/whats-the-difference-between-mysqldb-mysqlclient-and-mysql-connector-python) for more info.
270273

271-
```
274+
```bash
272275
pip install mysqlclient==1.4.2
273276
```
274277

@@ -278,7 +281,7 @@ pip install mysqlclient==1.4.2
278281
* If you're using AWS, you can setup an [Amazon S3](https://aws.amazon.com/s3/) account for saving your log files and screenshots for future viewing. SeleniumBase already has [all the code you need to connect to S3](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/s3_logging_plugin.py). You'll need to modify [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) with connection details to your instance and the location in S3 where you want log files to be saved. You'll also need to add "``--with-s3_logging``" on the command line when you run your tests.
279282

280283
Here's an example of running tests with additional features enabled:
281-
```
284+
```bash
282285
pytest [YOUR_TEST_FILE].py --browser=chrome --with-db_reporting --with-s3_logging -s
283286
```
284287
(NOTE: If you haven't configured your MySQL or S3 connections in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py), don't use ``--with-db_reporting`` or ``--with-s3_logging``.)
@@ -287,15 +290,15 @@ When the testing_base plugin is used, if there's a test failure, the basic_test_
287290

288291
To simplify that long run command, you can create a ``*.cfg`` file, such as the one provided in the example, and enter your plugins there so that you can run everything by typing:
289292

290-
```
293+
```bash
291294
nosetests [YOUR_TEST_FILE].py --config=[MY_CONFIG_FILE].cfg
292295
```
293296

294297
You can simplify that even more by using a setup.cfg file, such as the one provided for you in the examples folder. If you kick off a test run from within the folder that setup.cfg is location in, that file will automatically be used as your configuration, meaning that you wouldn't have to type out all the plugins that you want to use (or include a config file) everytime you run tests.
295298

296299
If you tell pytest/nosetests to run an entire file, it will run every method in that python file that starts with "test". You can be more specific on what to run by doing something like the following: (<i>Note that the syntax is different for pytest vs nosetests.</i>)
297300

298-
```
301+
```bash
299302
pytest [YOUR_TEST_FILE].py::[SOME_CLASS_NAME]::test_[SOME_TEST_NAME]
300303
nosetests [YOUR_TEST_FILE].py:[SOME_CLASS_NAME].test_[SOME_TEST_NAME]
301304
```
@@ -314,7 +317,7 @@ class MyTestClass(BaseCase):
314317

315318
You can run it from the ``examples`` folder like this:
316319

317-
```
320+
```bash
318321
pytest test_fail.py
319322
```
320323

@@ -611,16 +614,17 @@ pytest --reruns 5 --reruns-delay 1
611614

612615
Additionally, you can use the ``@retry_on_exception()`` decorator to specifically retry failing methods. (First import: ``from seleniumbase import decorators``) To learn more about SeleniumBase decorators, [click here](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/common).
613616

614-
#### Checking Email:
617+
#### Email Testing / Checking Email:
615618
Let's say you have a test that sends an email, and now you want to check that the email was received:
616619

617620
```python
618621
from seleniumbase.fixtures.email_manager import EmailManager, EmailException
619622
num_email_results = 0
620623
email_subject = "This is the subject to search for (maybe include a timestamp)"
621-
email_manager = EmailManager("{YOUR SELENIUM GMAIL ACCOUNT EMAIL ADDRESS}") # the password for this would be stored in seleniumbase/config/settings.py
624+
email_manager = EmailManager("{YOUR SELENIUM GMAIL ACCOUNT EMAIL ADDRESS}")
625+
# the password for this would be stored in seleniumbase/config/settings.py
622626
try:
623-
html_text = email_manager.search(SUBJECT="%s" % email_subject, timeout=300)
627+
html_text = email_manager.search(SUBJECT="%s" % email_subject, timeout=60)
624628
num_email_results = len(html_text)
625629
except EmailException:
626630
num_email_results = 0
@@ -629,7 +633,6 @@ self.assert_true(num_email_results) # true if not zero
629633

630634
Now you can parse through the email if you're looking for specific text or want to navigate to a link listed there.
631635

632-
633636
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Wrap-Up
634637

635638
#### Congratulations on getting started with SeleniumBase!

examples/handle_alert_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import time
2+
from seleniumbase import BaseCase
3+
4+
5+
class MyTestClass(BaseCase):
6+
7+
def test_alerts(self):
8+
self.open("about:blank")
9+
self.execute_script('window.alert("ALERT!!!")')
10+
time.sleep(1.2) # Not needed (Lets you see the alert pop up)
11+
self.wait_for_and_accept_alert()
12+
time.sleep(0.8) # Not needed (Lets you see the alert go away)

help_docs/customizing_test_runs.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,15 @@ nosetests test_suite.py --report
156156

157157
(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.)
158158

159-
Here are some other useful **nosetest**-specific arguments:
159+
Here are some other useful arguments:
160+
```bash
161+
-v # Prints the full test name rather than a dot for each test.
162+
-x # Stop running the tests after the first failure is reached.
163+
```
160164

165+
Here's a **nosetests**-specific argument:
161166
```bash
162167
--logging-level=INFO # Hide DEBUG messages, which can be overwhelming.
163-
-x # Stop running the tests after the first failure is reached.
164-
-v # Prints the full test name rather than a dot for each test.
165-
--with-id # If -v is also used, will number the tests for easy counting.
166168
```
167169

168170
#### **Using a Proxy Server:**

requirements.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
pip>=19.2.2
22
setuptools>=41.1.0
33
wheel>=0.33.4
4-
six
5-
nose
6-
ipdb
7-
unittest2
4+
six>=1.12.0
5+
nose>=1.3.7
6+
ipdb>=0.12.2
87
idna==2.8
98
chardet==3.0.4
109
urllib3==1.25.3
1110
requests>=2.22.0
1211
selenium==3.141.0
1312
pluggy>=0.12.0
1413
pytest>=4.6.5;python_version<"3"
15-
pytest>=5.0.1;python_version>="3"
14+
pytest>=5.1.0;python_version>="3"
1615
pytest-cov>=2.7.1
1716
pytest-forked>=1.0.2
1817
pytest-html==1.22.0

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
setup(
1919
name='seleniumbase',
20-
version='1.29.0',
20+
version='1.29.1',
2121
description='Fast, Easy, and Reliable Browser Automation & Testing.',
2222
long_description=long_description,
2323
long_description_content_type='text/markdown',
@@ -58,14 +58,14 @@
5858
'six',
5959
'nose',
6060
'ipdb',
61-
'unittest2',
6261
'idna==2.8', # Must stay in sync with "requests"
6362
'chardet==3.0.4', # Must stay in sync with "requests"
6463
'urllib3==1.25.3', # Must stay in sync with "requests"
6564
'requests>=2.22.0',
6665
'selenium==3.141.0',
6766
'pluggy>=0.12.0',
68-
'pytest>=4.6.5', # Keep at >=4.6.5 for Python 2 compatibility
67+
'pytest>=4.6.5;python_version<"3"', # For Python 2 compatibility
68+
'pytest>=5.1.0;python_version>="3"',
6969
'pytest-cov>=2.7.1',
7070
'pytest-forked>=1.0.2',
7171
'pytest-html==1.22.0', # Keep at 1.22.0 unless tested on Windows

0 commit comments

Comments
 (0)