Skip to content

Commit ec82ca0

Browse files
committed
Update the docs
1 parent 32c1e0f commit ec82ca0

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

README.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,36 @@ pytest my_first_test.py --demo
149149
150150
> (Chrome is the default browser if not specified with ``--browser``. On Linux, ``--headless`` is the default behavior.)
151151
152-
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py"><img src="https://seleniumbase.io/cdn/gif/my_first_test_2.gif" alt="SeleniumBase Test" title="SeleniumBase Demo Mode" width="400" /></a>
152+
<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py"><img src="https://seleniumbase.io/cdn/gif/swag_labs_4.gif" alt="SeleniumBase Test" title="SeleniumBase Test" width="400" /></a>
153+
154+
<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>
155+
156+
```python
157+
from seleniumbase import BaseCase
158+
159+
class MyTestClass(BaseCase):
160+
def test_swag_labs(self):
161+
self.open("https://www.saucedemo.com")
162+
self.type("#user-name", "standard_user")
163+
self.type("#password", "secret_sauce\n")
164+
self.assert_element("#inventory_container")
165+
self.assert_text("PRODUCTS", "span.title")
166+
self.click('button[name*="backpack"]')
167+
self.click("#shopping_cart_container a")
168+
self.assert_text("YOUR CART", "span.title")
169+
self.assert_text("Backpack", "div.cart_item")
170+
self.click("button#checkout")
171+
self.type("#first-name", "SeleniumBase")
172+
self.type("#last-name", "Automation")
173+
self.type("#postal-code", "77123")
174+
self.click("input#continue")
175+
self.assert_text("CHECKOUT: OVERVIEW")
176+
self.assert_text("Backpack", "div.cart_item")
177+
self.click("button#finish")
178+
self.assert_exact_text("THANK YOU FOR YOUR ORDER", "h2")
179+
self.assert_element('img[alt="Pony Express"]')
180+
self.js_click("a#logout_sidebar_link")
181+
```
153182
154183
* By default, **[CSS Selectors](https://www.w3schools.com/cssref/css_selectors.asp)** are used for finding page elements.
155184
* If you're new to CSS Selectors, games like [CSS Diner](http://flukeout.github.io/) can help you learn.

examples/ReadMe.md

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Run an example test in Chrome: (Default: ``--browser=chrome``)
2121
pytest my_first_test.py
2222
```
2323

24+
<img src="https://seleniumbase.io/cdn/gif/swag_labs_4.gif" /><br />
25+
2426
Run an example test in Firefox:
2527

2628
```bash
@@ -29,14 +31,6 @@ pytest my_first_test.py --browser=firefox
2931

3032
Run an example test in Demo Mode: (highlight assertions)
3133

32-
```bash
33-
pytest my_first_test.py --demo
34-
```
35-
36-
<img src="https://seleniumbase.io/cdn/gif/my_first_test_2.gif" title="SeleniumBase Demo Mode" /><br />
37-
38-
Run a different example in Demo Mode:
39-
4034
```bash
4135
pytest test_swag_labs.py --demo
4236
```

0 commit comments

Comments
 (0)