You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*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.
64
64
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/):
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
+
103
141
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Download a webdriver:</h3>
104
142
105
143
SeleniumBase can download webdrivers to the [seleniumbase/drivers](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/drivers) folder with the ``install`` command:
144
+
106
145
```bash
107
146
sbase install chromedriver
108
147
```
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.
110
150
* 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
+
111
152
```bash
112
153
sbase install chromedriver latest
113
154
```
114
155
156
+
* If you run a test without the correct webdriver installed, the driver will be downloaded automatically.
157
+
115
158
(See [seleniumbase.io/seleniumbase/console_scripts/ReadMe/](https://seleniumbase.io/seleniumbase/console_scripts/ReadMe/) for more information on SeleniumBase console scripts.)
116
159
117
160
<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
123
166
cd ui_tests/
124
167
```
125
168
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>
127
183
128
184
```bash
129
185
pytest test_demo_site.py
@@ -259,31 +315,6 @@ For a full list of SeleniumBase features, <a href="https://github.com/seleniumba
<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
-
287
318
<a id="seleniumbase_demo_mode"></a><b>Use Demo Mode to help you see what tests are asserting.</b>
288
319
289
320
If the example test is moving too fast foryour eyes, you can run itin**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
404
435
(Settings include default timeout values, a two-factor auth key, DB credentials, S3 credentials, and other important settings used by tests.)
405
436
406
437
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.
408
439
409
440
410
441
<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
524
555
<a id="utilizing_advanced_features"></a>
525
556
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Production Environments & Integrations:</h3>
526
557
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:
528
559
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 <ahref="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/jenkins/ReadMe.md">SeleniumBase Jenkins example on Azure</a> or the <ahref="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>.
530
561
531
562
* 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.
532
563
533
564
* 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.
534
565
535
566
* 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).
536
567
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 forsaving 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 detailsin the S3 section, and add "``--with-s3-logging``" on the command-line when running your tests.
538
569
539
570
Here's an example of running tests with additional features enabled:
0 commit comments