|
5 | 5 | <meta property="og:image" content="https://seleniumbase.io/cdn/img/mac_sb_logo_5.png" />
|
6 | 6 | <link rel="icon" href="https://seleniumbase.io/img/green_logo.png" />
|
7 | 7 |
|
8 |
| -<h3 align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/mac_sb_logo_9.png" alt="SeleniumBase" title="SeleniumBase" width="308" /></a></h3> |
| 8 | +<h3 align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/mac_sb_logo_8.png" alt="SeleniumBase" title="SeleniumBase" width="310" /></a></h3> |
9 | 9 | <!-- View on GitHub -->
|
10 |
| -<h4 align="center">Better Web Testing with <a href="https://www.selenium.dev/documentation/" target="_blank">Selenium</a> and <a href="https://docs.pytest.org/en/stable/" target="_blank">Pytest</a>.</h4> |
| 10 | +<h4 align="center">Better Web Testing with <a href="https://www.selenium.dev/documentation/" target="_blank">Selenium</a> and <a href="https://docs.pytest.org/en/stable/" target="_blank">pytest</a>.</h4> |
11 | 11 | <p align="center">
|
12 | 12 | <a href="https://github.com/seleniumbase/SeleniumBase/releases">
|
13 | 13 | <img src="https://img.shields.io/github/v/release/seleniumbase/SeleniumBase.svg?color=2277EE" alt="Latest Release on GitHub" /></a> <a href="https://pypi.python.org/pypi/seleniumbase" target="_blank">
|
|
45 | 45 |
|
46 | 46 | --------
|
47 | 47 |
|
48 |
| -<p align="left">⭐ An example test using the <code>BaseCase</code> class:</p> |
| 48 | +<p align="left">🔵 An example test using the <code>BaseCase</code> class:</p> |
49 | 49 |
|
50 | 50 | ```python
|
51 | 51 | from seleniumbase import BaseCase
|
52 | 52 |
|
53 |
| -class Test_MFA_Login(BaseCase): |
| 53 | +class TestMFALogin(BaseCase): |
54 | 54 | def test_mfa_login(self):
|
55 | 55 | self.open("https://seleniumbase.io/realworld/login")
|
56 |
| - self.type("input#username", "demo_user") |
57 |
| - self.type("input#password", "secret_pass") |
| 56 | + self.type("#username", "demo_user") |
| 57 | + self.type("#password", "secret_pass") |
58 | 58 | self.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG")
|
59 |
| - self.click('a:contains("This Page")') |
| 59 | + self.assert_element("img#image1") |
60 | 60 | self.assert_text("Welcome!", "h1")
|
| 61 | + self.click('a:contains("This Page")') |
61 | 62 | self.save_screenshot_to_logs()
|
62 | 63 | ```
|
63 | 64 |
|
64 |
| -<p align="left">⭐ An example test using the <code>sb</code> fixture:</p> |
| 65 | +<p align="left">🔵 An example test using the <code>sb</code> pytest fixture:</p> |
65 | 66 |
|
66 | 67 | ```python
|
67 | 68 | def test_mfa_login(sb):
|
68 | 69 | sb.open("https://seleniumbase.io/realworld/login")
|
69 |
| - sb.type("input#username", "demo_user") |
70 |
| - sb.type("input#password", "secret_pass") |
| 70 | + sb.type("#username", "demo_user") |
| 71 | + sb.type("#password", "secret_pass") |
71 | 72 | sb.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG")
|
72 |
| - sb.click('a:contains("This Page")') |
| 73 | + sb.assert_element("img#image1") |
73 | 74 | sb.assert_text("Welcome!", "h1")
|
| 75 | + sb.click('a:contains("This Page")') |
74 | 76 | sb.save_screenshot_to_logs()
|
75 | 77 | ```
|
76 | 78 |
|
77 |
| -<p align="left">⭐ An example of running a test: <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py">test_demo_site.py</a></p> |
| 79 | +<p align="left">🔵 An example of running a test: <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py">test_demo_site.py</a></p> |
78 | 80 |
|
79 | 81 | ```bash
|
80 | 82 | cd examples/
|
|
0 commit comments