Skip to content

Commit 8fe0bd7

Browse files
committed
Update the ReadMe
1 parent 1268376 commit 8fe0bd7

File tree

1 file changed

+70
-13
lines changed

1 file changed

+70
-13
lines changed

README.md

Lines changed: 70 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,52 @@
1-
<img src="https://cdn2.hubspot.net/hubfs/100006/images/expanded_icons_2.png" title="SeleniumBase" height="145">
1+
<img src="https://cdn2.hubspot.net/hubfs/100006/images/SB_Logo3d.png" title="SeleniumBase" height="48">
22

3-
## SeleniumBase &middot; [![](https://img.shields.io/pypi/v/seleniumbase.svg)](https://pypi.python.org/pypi/seleniumbase) [![Build Status](https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master)](https://travis-ci.org/seleniumbase/SeleniumBase)<br />
3+
[![](https://img.shields.io/pypi/v/seleniumbase.svg)](https://pypi.python.org/pypi/seleniumbase) [![Build Status](https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master)](https://travis-ci.org/seleniumbase/SeleniumBase) [![GitHub stars](https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg "GitHub stars")](https://github.com/seleniumbase/SeleniumBase/stargazers)<br />
44

5-
SeleniumBase simplifies browser-based test automation with [WebDriver](https://docs.microsoft.com/en-us/microsoft-edge/webdriver) & [Pytest](https://github.com/pytest-dev/pytest).
5+
A reliable solution for fast & simple browser automation and testing with [WebDriver](https://docs.microsoft.com/en-us/microsoft-edge/webdriver) & [Pytest](https://github.com/pytest-dev/pytest).
66

7-
#### Quick start in a few steps: (requires [Python](https://www.python.org/downloads/))
7+
#### Quick start in a few steps: (Requires [Python](https://www.python.org/downloads/) and [Git](https://git-scm.com/))
88

99
```bash
10-
python -m pip install -U pip
11-
pip install -U seleniumbase --no-cache-dir
10+
git clone https://github.com/seleniumbase/SeleniumBase.git
11+
cd SeleniumBase
12+
python -m pip install pip --upgrade
13+
pip install -r requirements.txt --upgrade
14+
python setup.py develop
15+
1216
seleniumbase install chromedriver
13-
seleniumbase mkdir browser_tests
14-
cd browser_tests
17+
18+
cd examples
1519
pytest my_first_test.py --browser=chrome
1620
```
1721

18-
The ``seleniumbase mkdir [NAME]`` command creates a new folder with sample tests. To use a different browser other than Chrome, use ``seleniumbase install [DRIVER]`` with ``edgedriver`` (Microsoft Edge) or ``geckodriver`` (Firefox). Then you can use ``--browser=edge`` or ``--browser=firefox`` to run tests on those browsers. ``--browser=chrome`` is the default option.
22+
SeleniumBase has a very flexible [command line interface](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md) to change how your tests run. The following will run the same test from above using Nosetests and Firefox with geckodriver (although Pytest is recommended over Nosetests):
23+
24+
```bash
25+
seleniumbase install geckodriver
26+
nosetests my_first_test.py --browser=firefox
27+
```
28+
29+
Try out Demo Mode to see what what's being tested in real time! (Chrome is the default browser if not specified.)
1930

20-
**Slow-motion demo of [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) running:**<br>
21-
![](https://cdn2.hubspot.net/hubfs/100006/images/sb_demo.gif "SeleniumBase")<br>
31+
```bash
32+
pytest my_first_test.py --demo_mode
33+
```
34+
35+
![](https://cdn2.hubspot.net/hubfs/100006/images/sb_demo.gif "SeleniumBase")<br />
36+
(Above: Actual demo of [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) running against [xkcd.com](http://xkcd.com/353/))
2237

2338
There are many more examples to try out from the [SeleniumBase/examples](https://github.com/seleniumbase/SeleniumBase/blob/master/examples) directory, which you can run easily if you clone SeleniumBase.
2439

40+
Try out SeleniumBase Website Tours (from the ``examples/tour_examples`` folder). It's the best website onboarding experience available (and it's free too). Find the [WebSite Tours ReadMe here](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md).
41+
42+
```bash
43+
cd tour_examples
44+
pytest google_tour.py
45+
```
46+
47+
![](https://cdn2.hubspot.net/hubfs/100006/images/google_tour.gif "SeleniumBase Tours")<br />
48+
(Above: Actual demo of [google_tour.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/google_tour.py) running against [google.com](https://google.com))
49+
2550
For more detailed steps on getting started, see the [**Detailed Instructions**](#seleniumbase_installation) section.
2651

2752
### Learn More:
@@ -205,13 +230,45 @@ pytest my_test_suite.py --browser=firefox
205230

206231
If you want to run tests headlessly, use ``--headless``, which you'll need to do if your system lacks a GUI interface. Even if your system does have a GUI interface, it may still support headless browser automation.
207232

233+
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.
234+
235+
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.
236+
237+
<img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="120">
238+
239+
### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") **Using SeleniumBase as your personal framework:**
240+
241+
You can install SeleniumBase without cloning the repo by doing this:
242+
243+
```bash
244+
python -m pip install -U pip
245+
pip install -U seleniumbase --no-cache-dir
246+
```
247+
248+
Now you can install webdrivers by doing this:
249+
250+
```bash
251+
seleniumbase install chromedriver
252+
seleniumbase install geckodriver
253+
```
254+
255+
Remember, you'll need chromedriver if you want to run automation on Chrome, geckodriver if you want to run automation on Firefox, edgedriver for Microsoft Edge, etc.
256+
257+
When creating your own test directories, keep these two things in mind:
258+
208259
For running tests outside of the SeleniumBase repo with **Pytest**, you'll want a copy of **[pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini)** on the root folder. (Subfolders should include a blank ``__init__.py`` file.)
209260

210261
For running tests outside of the SeleniumBase repo with **Nosetests**, you'll want a copy of **[setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg)** on the root folder. (Subfolders should include a blank ``__init__.py`` file.)
211262

212-
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.
263+
(You'll be able to customize those files as needed.)
213264

214-
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.
265+
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:
266+
267+
```bash
268+
seleniumbase mkdir browser_tests
269+
cd browser_tests
270+
pytest my_first_test.py --browser=chrome
271+
```
215272

216273
<img src="https://cdn2.hubspot.net/hubfs/100006/images/logo_base_4b.png" title="SeleniumBase" height="120">
217274

0 commit comments

Comments
 (0)