Skip to content

Commit 16b1e4a

Browse files
committed
Update the docs
1 parent 37ddaff commit 16b1e4a

File tree

4 files changed

+79
-49
lines changed

4 files changed

+79
-49
lines changed

README.md

Lines changed: 56 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,57 +58,88 @@ 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" /> Get Started:</h2>
61+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Start 🚀:</h2>
6262

63-
* Requires **[Python](https://www.python.org/downloads/)** and **[Git](https://git-scm.com/)**
64-
* [<img src="https://img.shields.io/pypi/pyversions/seleniumbase.svg?color=22AAEE" alt="Python:2.7|3.5|3.6|3.7|3.8|3.9" />](https://www.python.org/downloads/)
65-
* A [Python virtual env](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/) is recommended. <i><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md">See shortcut</a>.</i>
63+
* Get **[Python](https://www.python.org/downloads/)** and **[Git](https://git-scm.com/)**
6664

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

69-
* macOS/Linux: ``python3 -m pip install -U pip``
70-
* Windows(Cmd): ``py -m pip install -U pip``
67+
* macOS/Linux:
7168

72-
<a id="install_seleniumbase"></a>
73-
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Install SeleniumBase:</h2>
69+
```bash
70+
python3 -m pip install -U pip
71+
python3 -m venv sbase_env
72+
source sbase_env/bin/activate
73+
```
74+
75+
* Windows(Cmd):
7476

7577
```bash
76-
git clone https://github.com/seleniumbase/SeleniumBase.git
77-
cd SeleniumBase/
78-
pip install .
78+
py -m pip install -U pip
79+
py -m venv sbase_env
80+
call sbase_env\\Scripts\\activate
7981
```
8082

81-
* You can also install ``seleniumbase`` from [pypi](https://pypi.python.org/pypi/seleniumbase).
83+
<a id="install_seleniumbase"></a>
84+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Install SeleniumBase:</h2>
85+
86+
You can install ``seleniumbase`` from [pypi](https://pypi.python.org/pypi/seleniumbase):
87+
8288
```bash
8389
pip install seleniumbase
8490
```
91+
8592
* Add ``--upgrade`` OR ``-U`` to upgrade an installation.
8693
* Add ``--force-reinstall`` to also upgrade dependencies.
8794

95+
You can also install SeleniumBase from a [GitHub](https://github.com/seleniumbase/SeleniumBase) clone:
96+
97+
```bash
98+
git clone https://github.com/seleniumbase/SeleniumBase.git
99+
cd SeleniumBase/
100+
pip install .
101+
```
102+
88103
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Download a webdriver:</h3>
89104

90-
SeleniumBase can download a webdriver to the [seleniumbase/drivers](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/drivers) folder with the ``install`` command:
105+
SeleniumBase can download webdrivers to the [seleniumbase/drivers](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/drivers) folder with the ``install`` command:
91106
```bash
92-
seleniumbase install chromedriver
107+
sbase install chromedriver
93108
```
94-
* You need a different webdriver 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.
109+
* You need a different webdriver for each browser: ``chromedriver`` for Chrome, ``edgedriver`` for Edge, ``geckodriver`` for Firefox, and ``operadriver`` for Opera.
95110
* 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>):
96111
```bash
97-
seleniumbase install chromedriver latest
112+
sbase install chromedriver latest
98113
```
99114

100-
(See [seleniumbase.io/seleniumbase/console_scripts/ReadMe/](https://seleniumbase.io/seleniumbase/console_scripts/ReadMe/) for more information on SeleniumBase console scripts, such as ``seleniumbase install`` and ``seleniumbase mkdir``.)
115+
(See [seleniumbase.io/seleniumbase/console_scripts/ReadMe/](https://seleniumbase.io/seleniumbase/console_scripts/ReadMe/) for more information on SeleniumBase console scripts.)
101116

102-
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Run a test on Chrome:</h3>
117+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Create and run tests:</h3>
118+
119+
* Use ``sbase mkdir DIR`` to create a folder with sample tests:
103120

104121
```bash
105-
cd examples/
106-
pytest my_first_test.py
122+
sbase mkdir ui_tests
123+
cd ui_tests/
124+
```
125+
126+
* Now run a sample test with ``pytest``:
127+
128+
```bash
129+
pytest test_demo_site.py
107130
```
108131

109132
* Chrome is the default browser if not specified with ``--browser=BROWSER``.
110133
* On Linux ``--headless`` is the default behavior (running with no GUI). You can also run in headless mode on any OS. If your Linux machine has a GUI and you want to see the web browser as tests run, add ``--headed`` or ``--gui``.
111134

135+
<b>If you've cloned SeleniumBase from GitHub, you can also run tests from the [SeleniumBase/examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) folder:</b>
136+
137+
```bash
138+
cd examples/
139+
pytest my_first_test.py
140+
pytest test_swag_labs.py
141+
```
142+
112143
<b>Run [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) in Demo Mode:</b>
113144

114145
```bash
@@ -193,7 +224,7 @@ element.send_keys("dogs")
193224
element.submit()
194225
```
195226

196-
As you can see, the old WebDriver way is very bad!
227+
As you can see, the old WebDriver way is not efficient!
197228
Use SeleniumBase to make testing much easier!
198229
(You can still use ``self.driver`` in your code.)
199230

@@ -380,12 +411,12 @@ Now inside your tests, you can use ``self.data`` to access that.
380411

381412
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. 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.) These files specify default configuration details for tests. (For nosetest runs, you can also specify a .cfg file by using ``--config``. Example ``nosetests [MY_TEST].py --config=[MY_CONFIG].cfg``)
382413

383-
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:
414+
As a shortcut, you'll be able to run ``sbase mkdir [DIRECTORY]`` to create a new folder that already contains necessary files and some example tests that you can run.
384415

385416
```bash
386-
seleniumbase mkdir ui_tests
417+
sbase mkdir ui_tests
387418
cd ui_tests/
388-
pytest my_first_test.py
419+
pytest test_demo_site.py
389420
```
390421

391422

examples/translations/ReadMe.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77

88
Examples can be found in [<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/translations">SeleniumBase/examples/translations</a>].
99

10-
Multi-language tests are run with **pytest** like any other test. Every test method has a one-to-one mapping to every other supported language.<br /><i>Examples:</i>
10+
Multi-language tests are run with **pytest** like any other test. Every test method has a one-to-one mapping to every other supported language. <i>Example:</i>
1111
```
12-
self.开启网址(URL) = self.open(URL)
13-
self.нажмите(CSS) = self.click(CSS)
14-
self.뒤로() = self.go_back()
12+
self.open(URL) <=> self.开启网址(URL)
1513
```
1614

1715
<a id="translation_api"></a>
@@ -25,7 +23,7 @@ seleniumbase translate
2523

2624
```
2725
* Usage:
28-
seleniumbase translate [SB_FILE].py [LANGUAGE] [ACTION]
26+
seleniumbase translate [SB_FILE.py] [LANGUAGE] [ACTION]
2927
3028
* Languages:
3129
``--en`` / ``--English`` | ``--zh`` / ``--Chinese``

help_docs/translations.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77

88
Examples can be found in [<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples/translations">SeleniumBase/examples/translations</a>].
99

10-
Multi-language tests are run with **pytest** like any other test. Every test method has a one-to-one mapping to every other supported language.<br /><i>Examples:</i>
10+
Multi-language tests are run with **pytest** like any other test. Every test method has a one-to-one mapping to every other supported language. <i>Example:</i>
1111
```
12-
self.开启网址(URL) = self.open(URL)
13-
self.нажмите(CSS) = self.click(CSS)
14-
self.뒤로() = self.go_back()
12+
self.open(URL) <=> self.开启网址(URL)
1513
```
1614

1715
<a id="translation_api"></a>
@@ -25,7 +23,7 @@ seleniumbase translate
2523

2624
```
2725
* Usage:
28-
seleniumbase translate [SB_FILE].py [LANGUAGE] [ACTION]
26+
seleniumbase translate [SB_FILE.py] [LANGUAGE] [ACTION]
2927
3028
* Languages:
3129
``--en`` / ``--English`` | ``--zh`` / ``--Chinese``

help_docs/virtualenv_instructions.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Virtual Environment Tutorial</h2>
22

3-
### Step 1: Install VirtualEnv and VirtualEnvWrapper:
3+
### Step 0: Install VirtualEnvWrapper (<i>optional</i>):
4+
5+
* ``virtualenvwrapper`` can make it easier to work with [Python virtual environments](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/) by giving you the ``mkvirtualenv`` command.
46

57
### macOS / Linux:
68

79
(*Shortcut*: Run "``source virtualenv_install.sh``" from the top-level SeleniumBase folder to perform the following steps.)
810

911
```bash
10-
python3 -m pip install pip wheel --force-reinstall
1112
python3 -m pip install virtualenvwrapper --force-reinstall
1213
export WORKON_HOME=$HOME/.virtualenvs
1314
source `which virtualenvwrapper.sh`
@@ -17,43 +18,45 @@ If you add ``source `which virtualenvwrapper.sh` `` to your local bash file (``~
1718

1819
### Windows:
1920

20-
(*Shortcut*: Run "``virtualenv_install.bat``" from the top-level SeleniumBase folder to perform the following steps.)
21+
(*Shortcut*: Run "``win_virtualenv.bat``" from the top-level SeleniumBase folder to perform the following steps.)
2122

2223
```bash
23-
py -m pip install pip wheel --force-reinstall --user
2424
py -m pip install virtualenvwrapper-win --force-reinstall --user
2525
```
2626

27-
### Step 2: Create a virtual environment:
27+
### Step 1: Create a virtual environment:
2828

2929
### macOS / Linux:
3030

31-
* Using ``mkvirtualenv`` (any version of Python):
32-
```bash
33-
mkvirtualenv sbase_env
34-
```
35-
(If you have multiple versions of Python installed on your machine, and you want your virtual environment to use a specific Python version, add ``--python=PATH_TO_PYTHON_EXE`` with the Python executable to use.)
31+
* (Python 3) ``python3 -m venv ENV``:
3632

37-
* (Python 3) Using ``python3 -m venv``:
3833
```bash
3934
python3 -m venv sbase_env
4035
source sbase_env/bin/activate
4136
```
4237

43-
### Windows:
38+
* (Python 2, 3) ``mkvirtualenv ENV``:
4439

45-
* Using ``mkvirtualenv`` (any version of Python):
4640
```bash
4741
mkvirtualenv sbase_env
4842
```
4943
(If you have multiple versions of Python installed on your machine, and you want your virtual environment to use a specific Python version, add ``--python=PATH_TO_PYTHON_EXE`` with the Python executable to use.)
5044

51-
* (Python 3) Using ``py -m venv``:
45+
### Windows:
46+
47+
* (Python 3) ``py -m venv ENV``:
48+
5249
```bash
5350
py -m venv sbase_env
5451
call sbase_env\\Scripts\\activate
5552
```
5653

54+
* (Python 2, 3) ``mkvirtualenv ENV``:
55+
```bash
56+
mkvirtualenv sbase_env
57+
```
58+
(If you have multiple versions of Python installed on your machine, and you want your virtual environment to use a specific Python version, add ``--python=PATH_TO_PYTHON_EXE`` with the Python executable to use.)
59+
5760
---
5861

5962
### mkvirtualenv Commands

0 commit comments

Comments
 (0)