Skip to content

Commit 57007c5

Browse files
committed
Update documentation
1 parent 0a8666a commit 57007c5

File tree

5 files changed

+86
-81
lines changed

5 files changed

+86
-81
lines changed

README.md

Lines changed: 46 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111

1212
<p align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/sb_logo_10t.png" alt="SeleniumBase" title="SeleniumBase" width="266" /></a></p>
1313

14-
<h2 align="center" class="hero__title">All-in-one Test Automation Framework</h2>
15-
16-
<h3 align="center"><img src="https://seleniumbase.github.io/cdn/img/python_logo.png" title="SeleniumBase" width="29" /> For Python enthusiasts and enterprise developers <img src="https://seleniumbase.github.io/cdn/img/python_logo.png" title="SeleniumBase" width="29" /></h3>
14+
<p align="center" class="hero__title"><b>All-in-one Browser Automation Framework:<br />Web Crawling / Scraping / Testing / Reporting</b></p>
1715

1816
<p align="center"><a href="https://pypi.python.org/pypi/seleniumbase" target="_blank"><img src="https://img.shields.io/pypi/v/seleniumbase.svg?color=3399EE" alt="PyPI version" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/releases" target="_blank"><img src="https://img.shields.io/github/v/release/seleniumbase/SeleniumBase.svg?color=22AAEE" alt="GitHub version" /></a> <a href="https://seleniumbase.io"><img src="https://img.shields.io/badge/docs-seleniumbase.io-11BBAA.svg" alt="SeleniumBase Docs" /></a> <a href="https://github.com/seleniumbase/SeleniumBase/actions" target="_blank"><img src="https://github.com/seleniumbase/SeleniumBase/workflows/CI%20build/badge.svg" alt="SeleniumBase GitHub Actions" /></a> <a href="https://gitter.im/seleniumbase/SeleniumBase" target="_blank"><img src="https://img.shields.io/gitter/room/seleniumbase/SeleniumBase.svg" alt="Gitter chat"/></a></p>
1917

@@ -57,83 +55,67 @@
5755

5856
--------
5957

60-
<p align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/super_logo_sb2.png" alt="SeleniumBase" title="SeleniumBase" width="232" /></a></p>
61-
62-
<blockquote>
63-
<p dir="auto"><strong>Explore the README:</strong></p>
64-
<ul dir="auto">
65-
<li><a href="#install_seleniumbase" ><strong>Get Started / Installation</strong></a></li>
66-
<li><a href="#basic_example_and_usage"><strong>Basic Example / Usage</strong></a></li>
67-
<li><a href="#common_methods" ><strong>Common Test Methods</strong></a></li>
68-
<li><a href="#fun_facts" ><strong>Fun Facts / Learn More</strong></a></li>
69-
<li><a href="#demo_mode_and_debugging"><strong>Demo Mode / Debugging</strong></a></li>
70-
<li><a href="#command_line_options" ><strong>Command-line Options</strong></a></li>
71-
<li><a href="#directory_configuration"><strong>Directory Configuration</strong></a></li>
72-
<li><a href="#seleniumbase_dashboard" ><strong>SeleniumBase Dashboard</strong></a></li>
73-
<li><a href="#creating_visual_reports"><strong>Generating Test Reports</strong></a></li>
74-
</ul>
75-
</blockquote>
76-
77-
--------
78-
79-
<a id="multiple_examples"></a>
58+
📚 Learn from [**over 100 examples** in the **SeleniumBase/examples/**](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) folder.
8059

81-
<p align="left"><b>Example:</b> <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py" target="_blank">test_demo_site.py</a> from <a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples" target="_blank">./examples/</a> (Uses <code translate="no">--chrome</code> by default)</p>
60+
<p align="left">📗 Here's <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py">my_first_test.py</a>, which covers login, shopping, and checkout:</p>
8261

8362
```bash
84-
cd examples/
85-
pytest test_demo_site.py
63+
pytest my_first_test.py
8664
```
8765

88-
<p align="left"><a href="https://seleniumbase.io/demo_page" target="_blank"><img src="https://seleniumbase.github.io/cdn/gif/demo_page_5.gif" width="480" alt="SeleniumBase Example" title="SeleniumBase Example" /></a></p>
66+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py"><img src="https://seleniumbase.github.io/cdn/gif/fast_swag.gif" alt="SeleniumBase Test" title="SeleniumBase Test" width="480" /></a>
8967

90-
> Easy to type, click, select, toggle, drag-and-drop, etc.
68+
> ``pytest`` uses ``--chrome`` by default unless set differently.
9169
9270
--------
9371

94-
<p align="left"><b>Example:</b> <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_coffee_cart.py" target="_blank">test_coffee_cart.py</a> from <a href="https://github.com/seleniumbase/SeleniumBase/tree/master/examples" target="_blank">./examples/</a></p>
72+
<p align="left">📗 Here's <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_coffee_cart.py" target="_blank">test_coffee_cart.py</a>, which verifies an e-commerce site:</p>
9573

9674
```bash
97-
cd examples/
9875
pytest test_coffee_cart.py --demo
9976
```
10077

101-
<p>(<code translate="no">--demo</code> mode slows down tests and highlights actions)</p>
102-
10378
<p align="left"><a href="https://seleniumbase.io/coffee/" target="_blank"><img src="https://seleniumbase.github.io/cdn/gif/coffee_cart.gif" width="480" alt="SeleniumBase Coffee Cart Test" title="SeleniumBase Coffee Cart Test" /></a></p>
10479

105-
> SeleniumBase automation can easily order coffee!
80+
> <p>(<code translate="no">--demo</code> mode slows down tests and highlights actions)</p>
10681
107-
<p align="left"><b>Here's the code for <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_coffee_cart.py">test_coffee_cart.py</a>:</b></p>
82+
--------
10883

109-
```python
110-
from seleniumbase import BaseCase
111-
BaseCase.main(__name__, __file__)
84+
<a id="multiple_examples"></a>
11285

113-
class CoffeeCartTest(BaseCase):
114-
def test_coffee_cart(self):
115-
self.open("https://seleniumbase.io/coffee/")
116-
self.assert_title("Coffee Cart")
117-
self.assert_element('button:contains("Total: $0.00")')
118-
self.click('div[data-sb="Cappuccino"]')
119-
self.assert_exact_text("cart (1)", 'a[aria-label="Cart page"]')
120-
self.click('div[data-sb="Flat-White"]')
121-
self.assert_exact_text("cart (2)", 'a[aria-label="Cart page"]')
122-
self.click('div[data-sb="Cafe-Latte"]')
123-
self.assert_exact_text("cart (3)", 'a[aria-label="Cart page"]')
124-
self.click('a[aria-label="Cart page"]')
125-
self.assert_exact_text("Total: $53.00", "button.pay")
126-
self.click("button.pay")
127-
self.type("input#name", "Selenium Coffee")
128-
self.type("input#email", "[email protected]")
129-
self.click("button#submit-payment")
130-
self.assert_text("Thanks for your purchase.", "#app .success")
86+
<p align="left">📗 Here's <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py" target="_blank">test_demo_site.py</a>, which covers several actions:</p>
87+
88+
```bash
89+
pytest test_demo_site.py
13190
```
13291

92+
<p align="left"><a href="https://seleniumbase.io/demo_page" target="_blank"><img src="https://seleniumbase.github.io/cdn/gif/demo_page_5.gif" width="480" alt="SeleniumBase Example" title="SeleniumBase Example" /></a></p>
93+
94+
> Easy to type, click, select, toggle, drag & drop, and more.
95+
13396
(For more examples, see the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md">SeleniumBase/examples/</a> folder.)
13497

13598
--------
13699

100+
<p align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.github.io/cdn/img/super_logo_sb2.png" alt="SeleniumBase" title="SeleniumBase" width="232" /></a></p>
101+
102+
<blockquote>
103+
<p dir="auto"><strong>Explore the README:</strong></p>
104+
<ul dir="auto">
105+
<li><a href="#install_seleniumbase" ><strong>Get Started / Installation</strong></a></li>
106+
<li><a href="#basic_example_and_usage"><strong>Basic Example / Usage</strong></a></li>
107+
<li><a href="#common_methods" ><strong>Common Test Methods</strong></a></li>
108+
<li><a href="#fun_facts" ><strong>Fun Facts / Learn More</strong></a></li>
109+
<li><a href="#demo_mode_and_debugging"><strong>Demo Mode / Debugging</strong></a></li>
110+
<li><a href="#command_line_options" ><strong>Command-line Options</strong></a></li>
111+
<li><a href="#directory_configuration"><strong>Directory Configuration</strong></a></li>
112+
<li><a href="#seleniumbase_dashboard" ><strong>SeleniumBase Dashboard</strong></a></li>
113+
<li><a href="#creating_visual_reports"><strong>Generating Test Reports</strong></a></li>
114+
</ul>
115+
</blockquote>
116+
117+
--------
118+
137119
<details>
138120
<summary> ▶️ How is <b>SeleniumBase</b> different from raw Selenium? (<b>click to expand</b>)</summary>
139121
<div>
@@ -177,7 +159,7 @@ With raw Selenium, that requires more code:<br />
177159

178160
<p>📚 <b>Learn about different ways of writing tests:</b></p>
179161

180-
<p align="left">📘📝 An <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_simple_login.py">example test</a> using <code translate="no"><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py">BaseCase</a></code> class inheritance. Runs with <b><a href="https://docs.pytest.org/en/latest/how-to/usage.html">pytest</a></b> or <b><a href="https://github.com/mdmintz/pynose">pynose</a></b>. (<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md">Learn more</a>). (Use <code translate="no">self.driver</code> to access Selenium's raw <code translate="no">driver</code>.)</p>
162+
<p align="left">📘📝 Here's <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_simple_login.py">test_simple_login.py</a>, which uses <code translate="no"><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py">BaseCase</a></code> class inheritance, and runs with <a href="https://docs.pytest.org/en/latest/how-to/usage.html">pytest</a> or <a href="https://github.com/mdmintz/pynose">pynose</a>. (Use <code translate="no">self.driver</code> to access Selenium's raw <code translate="no">driver</code>.)</p>
181163

182164
```python
183165
from seleniumbase import BaseCase
@@ -196,7 +178,7 @@ class TestSimpleLogin(BaseCase):
196178
self.assert_text("signed out", "#top_message")
197179
```
198180

199-
<p align="left">📗📝 An <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/sb_fixture_tests.py">example test</a> using the <b><code translate="no">sb</code></b> <code translate="no">pytest</code> fixture. Runs with <b><a href="https://docs.pytest.org/en/latest/how-to/usage.html">pytest</a></b>. (Use <code translate="no">sb.driver</code> to access Selenium's raw <code translate="no">driver</code>.)</p>
181+
<p align="left">📗📝 Here's a test from <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/sb_fixture_tests.py">sb_fixture_tests.py</a>, which uses the <b><code translate="no">sb</code></b> <code translate="no">pytest</code> fixture. Runs with <a href="https://docs.pytest.org/en/latest/how-to/usage.html">pytest</a>. (Use <code translate="no">sb.driver</code> to access Selenium's raw <code translate="no">driver</code>.)</p>
200182

201183
```python
202184
def test_sb_fixture_with_no_class(sb):
@@ -211,7 +193,7 @@ def test_sb_fixture_with_no_class(sb):
211193
sb.assert_text("signed out", "#top_message")
212194
```
213195

214-
<p align="left">📙📝 An <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_login_sb.py">example test</a> using the <b><code translate="no">SB</code></b> Context Manager. Runs with pure <b><code translate="no">python</code></b>. (Use <code translate="no">sb.driver</code> to access Selenium's raw <code translate="no">driver</code>.)</p>
196+
<p align="left">📙📝 Here's <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_login_sb.py">raw_login_sb.py</a>, which uses the <b><code translate="no">SB</code></b> Context Manager. Runs with pure <code translate="no">python</code>. (Use <code translate="no">sb.driver</code> to access Selenium's raw <code translate="no">driver</code>.)</p>
215197

216198
```python
217199
from seleniumbase import SB
@@ -228,7 +210,7 @@ with SB() as sb:
228210
sb.assert_text("signed out", "#top_message")
229211
```
230212

231-
<p align="left">📔📝 An <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_login_context.py">example test</a> using the <b><code translate="no">DriverContext</code></b> Manager. Runs with pure <b><code translate="no">python</code></b>. (The <code translate="no">driver</code> is an improved version of Selenium's raw <code translate="no">driver</code>, with more methods.)</p>
213+
<p align="left">📔📝 Here's <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_login_context.py">raw_login_context.py</a>, which uses the <b><code translate="no">DriverContext</code></b> Manager. Runs with pure <code translate="no">python</code>. (The <code translate="no">driver</code> is an improved version of Selenium's raw <code translate="no">driver</code>, with more methods.)</p>
232214

233215
```python
234216
from seleniumbase import DriverContext
@@ -245,7 +227,7 @@ with DriverContext() as driver:
245227
driver.assert_text("signed out", "#top_message")
246228
```
247229

248-
<p align="left">📔📝 An <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_login_driver.py">example test</a> using the <b><code translate="no">Driver</code></b> Manager. Runs with pure <b><code translate="no">python</code></b>. (The <code>driver</code> is an improved version of Selenium's raw <code translate="no">driver</code>, with more methods.)</p>
230+
<p align="left">📔📝 Here's <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/raw_login_driver.py">raw_login_driver.py</a>, which uses the <b><code translate="no">Driver</code></b> Manager. Runs with pure <code translate="no">python</code>. (The <code>driver</code> is an improved version of Selenium's raw <code translate="no">driver</code>, with more methods.)</p>
249231

250232
```python
251233
from seleniumbase import Driver
@@ -265,7 +247,7 @@ finally:
265247
driver.quit()
266248
```
267249

268-
<p align="left">📕📝 An <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/behave_bdd/features/login_app.feature"> example test</a> using <b translate="no">behave-BDD</b> <a href="https://behave.readthedocs.io/en/stable/gherkin.html#features" target="_blank">Gherkin</a> syntax. Runs with <b><code translate="no">behave</code></b>. (<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/behave_bdd/ReadMe.md">Learn more</a>)</p>
250+
<p align="left">📕📝 Here's <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/behave_bdd/features/login_app.feature">login_app.feature</a>, which uses <a translate="no" href="https://behave.readthedocs.io/en/stable/gherkin.html#features" target="_blank">behave-BDD Gherkin</a> syntax. Runs with <code translate="no">behave</code>. (<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/behave_bdd/ReadMe.md">Learn about the <b>SeleniumBase behave-BDD</b> integration</a>)</p>
269251

270252
```gherkin
271253
Feature: SeleniumBase scenarios for the Simple App
@@ -410,11 +392,7 @@ cd examples/
410392
pytest my_first_test.py
411393
```
412394
413-
> (Uses ``--chrome`` by default.)
414-
415-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py"><img src="https://seleniumbase.github.io/cdn/gif/swag_labs_4.gif" alt="SeleniumBase Test" title="SeleniumBase Test" width="480" /></a>
416-
417-
> SeleniumBase easily handles login, shopping, and checkout.
395+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py"><img src="https://seleniumbase.github.io/cdn/gif/fast_swag.gif" alt="SeleniumBase Test" title="SeleniumBase Test" width="480" /></a>
418396
419397
<p align="left"><b>Here's the code for <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py">my_first_test.py</a>:</b></p>
420398
@@ -500,7 +478,7 @@ self.assert_no_js_errors() # Verify there are no JS errors.
500478
501479
<p>✅ SeleniumBase automatically handles common <a href="https://www.selenium.dev/documentation/webdriver/" target="_blank">WebDriver</a> actions such as launching web browsers before tests, saving screenshots during failures, and closing web browsers after tests.</p>
502480
503-
<p>✅ SeleniumBase lets you <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md">customize test runs from the command-line</a>.</p>
481+
<p>✅ SeleniumBase lets you customize tests via <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md">command-line options</a>.</p>
504482
505483
<p>✅ SeleniumBase uses simple syntax for commands. Example:</p>
506484
@@ -852,7 +830,7 @@ python -m http.server 1948
852830
🔵 Here's a full example of what the SeleniumBase Dashboard may look like:
853831
854832
```bash
855-
pytest test_suite.py --dashboard --rs --headless
833+
pytest test_suite.py test_image_saving.py --dashboard --rs --headless
856834
```
857835
858836
<img src="https://seleniumbase.github.io/cdn/img/dashboard_2.png" alt="The SeleniumBase Dashboard" title="The SeleniumBase Dashboard" width="480" />

help_docs/demo_mode.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,25 @@
22

33
## [<img src="https://seleniumbase.io/img/logo6.png" title="SeleniumBase" width="32">](https://github.com/seleniumbase/SeleniumBase/) Demo Mode 🎦
44

5-
<p align="left"><img src="https://seleniumbase.github.io/cdn/gif/xkcd_vid.gif" width="400" alt="SeleniumBase Example" title="SeleniumBase Example" /></p>
5+
<p align="left"><img src="https://seleniumbase.github.io/cdn/gif/xkcd_vid.gif" width="480" alt="SeleniumBase Example" title="SeleniumBase Example" /></p>
66

77
<p align="left">🔵 <b translate="no">Demo Mode</b> helps you see what a test is doing.</p>
88

99
<p align="left">🏇💨 👀 If a test runs too fast for your eyes, use <b translate="no">Demo Mode</b> to slow it down, highlight actions, and display assertions. Example usage:</p>
1010

11+
```bash
12+
cd examples/
13+
pytest test_coffee_cart.py --demo
14+
```
15+
16+
<p align="left"><a href="https://seleniumbase.io/coffee/" target="_blank"><img src="https://seleniumbase.github.io/cdn/gif/coffee_cart.gif" width="480" alt="SeleniumBase Coffee Cart Test" title="SeleniumBase Coffee Cart Test" /></a></p>
17+
18+
> <p>(<code translate="no">--demo</code> mode slows down tests and highlights actions)</p>
19+
20+
--------
21+
22+
Another example:
23+
1124
```bash
1225
pytest my_first_test.py --demo
1326
```

0 commit comments

Comments
 (0)