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
<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
+
```
153
182
154
183
* By default, **[CSS Selectors](https://www.w3schools.com/cssref/css_selectors.asp)** are used for finding page elements.
155
184
* If you're new to CSS Selectors, games like [CSS Diner](http://flukeout.github.io/) can help you learn.
0 commit comments