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
Copy file name to clipboardExpand all lines: README.md
+8-17Lines changed: 8 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@ SeleniumBase was originally built for [testing HubSpot's platform](https://produ
63
63
64
64
## Get Started:
65
65
66
-
Before installation, **[install Python](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/install_python_pip_git.md)** and **[get a WebDriver](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/webdriver_installation.md)** on your system PATH.
66
+
Before installation, **[install Python](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/install_python_pip_git.md)** and **[install a web driver](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/webdriver_installation.md)**.
@@ -151,32 +151,23 @@ If the example test is moving too fast for your eyes to see what's going on, you
151
151
pytest my_first_test.py --demo_mode
152
152
```
153
153
154
-
You can override the default wait time by either updating [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) or by using ``--demo_sleep={NUM}`` when using Demo Mode. (NOTE: If you use ``--demo_sleep={NUM}`` without using ``--demo_mode``, nothing will happen.)
You can also use the following in your scripts to slow down the tests:
154
+
You can use the following in your scripts to help you debug issues::
161
155
162
156
```python
163
157
import time; time.sleep(5) # sleep for 5 seconds (add this after the line you want to pause on)
164
158
import ipdb; ipdb.set_trace() # waits for your command. n = next line of current method, c = continue, s = step / next executed line (will jump)
159
+
import pytest; pytest.set_trace() # similar to ipdb, but specific to pytest
165
160
```
166
161
167
-
(NOTE: If you're using pytest instead of nosetests and you want to use ipdb in your script for debugging purposes, you'll need to add ``--capture=no`` (or ``-s``) on the command line, or use ``import pytest; pytest.set_trace()`` instead of using ipdb. More info on that [here](http://stackoverflow.com/questions/2678792/can-i-debug-with-python-debugger-when-using-py-test-somehow).)
168
-
169
-
You may also want to have your test sleep in other situations where you need to have your test wait for something. If you know what you're waiting for, you should be specific by using a command that waits for something specific to happen.
170
-
171
-
If you need to debug things on the fly (in case of errors), use this:
162
+
**To pause an active test that throws an exception or error, add ``--pdb --pdb-failures -s``:**
The above code (with --pdb) will leave your browser window open in case there's a failure, which is possible if the web pages from the example change the data that's displayed on the page. (ipdb commands: 'c', 's', 'n' => continue, step, next). You may need the ``-s`` in order to see all console output.
168
+
The code above will leave your browser window open in case there's a failure. (ipdb commands: 'c', 's', 'n' => continue, step, next).
178
169
179
-
Here are some other useful nosetest arguments for appending to your run commands:
170
+
Here are some other useful **nosetest**-specific arguments:
180
171
181
172
```bash
182
173
--logging-level=INFO # Hide DEBUG messages, which can be overwhelming.
@@ -185,7 +176,7 @@ Here are some other useful nosetest arguments for appending to your run commands
185
176
--with-id # If -v is also used, will number the tests for easy counting.
186
177
```
187
178
188
-
During test failures you'll get detailed log files, which include screenshots, page source, and basic test info, which will get added to the logs folder at ``latest_logs/``. (Unless you have ARCHIVE_EXISTING_LOGS set to True in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py), log files with be cleaned up at the start of the next test run. If the archive feature is enabled, those logs will get saved to the ``archived_logs/`` folder.) The ``my_test_suite.py`` collection contains tests that fail on purpose so that you can see how logging works.
179
+
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 ``my_test_suite.py`` collection contains tests that fail on purpose so that you can see how logging works.
189
180
190
181
```bash
191
182
cd examples/
@@ -210,7 +201,7 @@ To run Pytest multithreaded on multiple CPUs at the same time, add ``-n=NUM`` or
210
201
<aid="creating_visual_reports"></a>
211
202
### **Creating Visual Test Suite Reports:**
212
203
213
-
(NOTE: The command line args are different for Pytest vs Nosetests)
204
+
(NOTE: Several command line args are different for Pytest vs Nosetests)
Copy file name to clipboardExpand all lines: console_scripts/ReadMe.md
+23-1Lines changed: 23 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,32 @@
1
1
## Console Scripts
2
2
3
+
SeleniumBase console scripts help you get things done more easily, such as installing web drivers, creating a test directory with necessary configuration files, converting old Webdriver unittest scripts into SeleniumBase code, and using the Selenium Grid.
4
+
5
+
For running tests from the command line, [use **pytest** with SeleniumBase](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md).
6
+
7
+
### install
8
+
9
+
* Usage:
10
+
``seleniumbase install [DRIVER_NAME]``
11
+
(Drivers: chromedriver, geckodriver, edgedriver)
12
+
13
+
* Example:
14
+
``seleniumbase install chromedriver``
15
+
16
+
* Output:
17
+
Installs the specified webdriver.
18
+
(chromedriver is required for Google Chrome automation)
19
+
(geckodriver is required for Mozilla Firefox automation)
20
+
(edgedriver is required for Microsoft Edge automation)
21
+
3
22
### mkdir
4
23
5
24
* Usage:
6
25
``seleniumbase mkdir [DIRECTORY_NAME]``
7
26
27
+
* Example:
28
+
``seleniumbase mkdir gui_tests``
29
+
8
30
* Output:
9
31
Creates a new folder for running SeleniumBase scripts.
0 commit comments