Skip to content

Commit 6661029

Browse files
committed
Update the ReadMe
1 parent 383fe52 commit 6661029

File tree

1 file changed

+39
-36
lines changed

1 file changed

+39
-36
lines changed

README.md

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
<meta property="og:description" content="Fast, easy, and reliable Web/UI testing with Python." />
44
<meta property="og:keywords" content="Python, pytest, selenium, webdriver, testing, automation, seleniumbase, framework, RPA, behave, BDD, nosetests, dashboard, recorder, reports, gui, screenshots">
55
<meta property="og:image" content="https://seleniumbase.io/cdn/img/mac_sb_logo_5.png" />
6-
<link rel="icon" href="https://seleniumbase.io/img/green_logo.png" />
6+
<link rel="icon" href="https://seleniumbase.io/img/green_logo2.png" />
77

8-
<h3 align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/mac_sb_logo_3.png" alt="SeleniumBase" title="SeleniumBase" width="360" /></a></h3>
8+
<h1 align="center"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/img/logo3b.png" alt="SeleniumBase" title="SeleniumBase" width="38" /></a> SeleniumBase <a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/img/dash_pie_2.png" alt="SeleniumBase" title="SeleniumBase" width="38" /></a></h1>
99
<!-- View on GitHub -->
1010

11-
<p align="center"><div align="center">A Python framework with everything you need to automate web testing.</div></p>
11+
<p align="center"><div align="center">Fast, easy, and reliable browser automation & testing with Python.</div></p>
1212

1313
<p align="center">
1414
<a href="https://github.com/seleniumbase/SeleniumBase/releases">
@@ -48,7 +48,7 @@
4848
--------
4949

5050
<details>
51-
<summary> (expand) ▶️ How is SeleniumBase different from raw Selenium?</summary>
51+
<summary> ▶️ How is SeleniumBase different from raw Selenium? (click to expand)</summary>
5252
<div>
5353

5454
<p>✔️ SeleniumBase is a Python test framework for the Selenium/WebDriver browser automation library. This framework incorporates test-runners such as <code>pytest</code>, <code>nosetests</code>, and <code>behave</code> to provide organized structure, test discovery, test execution, test state (<i>eg. passed, failed, or skipped</i>), and command-line options for changing default settings (<i>such as which browser to use</i>). With raw Selenium, you would need to set up your own options-parser for configuring tests from the command-line.</p>
@@ -71,7 +71,7 @@
7171
</div>
7272
</details>
7373

74-
<p align="left">✍️ An example with the <b>BaseCase</b> class. Runs with <code>pytest</code> or <code>nosetests</code>. (<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md">Learn more</a>)</p>
74+
<p align="left">📘 An example with the <b>BaseCase</b> class. Runs with <code>pytest</code> or <code>nosetests</code>. (<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/ReadMe.md">Learn more</a>)</p>
7575

7676
```python
7777
from seleniumbase import BaseCase
@@ -83,12 +83,12 @@ class TestMFALogin(BaseCase):
8383
self.type("#password", "secret_pass")
8484
self.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG") # 6-digit
8585
self.assert_element("img#image1")
86-
self.assert_text("Welcome!", "h1")
86+
self.assert_exact_text("Welcome!", "h1")
8787
self.click('a:contains("This Page")')
8888
self.save_screenshot_to_logs()
8989
```
9090

91-
<p align="left">✍️ An example with the <b>sb</b> <code>pytest</code> fixture. Runs with <code>pytest</code>.</p>
91+
<p align="left">📗 An example with the <b>sb</b> <code>pytest</code> fixture. Runs with <code>pytest</code>.</p>
9292

9393
```python
9494
def test_mfa_login(sb):
@@ -97,23 +97,23 @@ def test_mfa_login(sb):
9797
sb.type("#password", "secret_pass")
9898
sb.enter_mfa_code("#totpcode", "GAXG2MTEOR3DMMDG") # 6-digit
9999
sb.assert_element("img#image1")
100-
sb.assert_text("Welcome!", "h1")
100+
sb.assert_exact_text("Welcome!", "h1")
101101
sb.click('a:contains("This Page")')
102102
sb.save_screenshot_to_logs()
103103
```
104104

105-
<p align="left">✍️ An example with <b>behave-BDD</b> <a href="https://behave.readthedocs.io/en/stable/gherkin.html">Gherkin</a> structure. Runs with <code>behave</code>. (<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/behave_bdd/ReadMe.md">Learn more</a>)</p>
105+
<p align="left">📕 An example with <b>behave-BDD</b> <a href="https://behave.readthedocs.io/en/stable/gherkin.html">Gherkin</a> structure. Runs with <code>behave</code>. (<a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/behave_bdd/ReadMe.md">Learn more</a>)</p>
106106

107107
```gherkin
108108
Feature: SeleniumBase scenarios for the RealWorld App
109109
110-
Scenario: Verify RealWorld App (log in / sign out)
110+
Scenario: Verify RealWorld App
111111
Given Open "seleniumbase.io/realworld/login"
112112
When Type "demo_user" into "#username"
113113
And Type "secret_pass" into "#password"
114114
And Do MFA "GAXG2MTEOR3DMMDG" into "#totpcode"
115-
Then Assert exact text "Welcome!" in "h1"
116-
And Highlight "img#image1"
115+
Then Assert element "img#image1"
116+
And Assert exact text "Welcome!" in "h1"
117117
And Click 'a:contains("This Page")'
118118
And Save screenshot to logs
119119
```
@@ -128,14 +128,14 @@ pytest test_demo_site.py
128128
<p align="left"><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/test_demo_site.py"><img src="https://seleniumbase.io/cdn/gif/demo_page_4.gif" width="400" alt="SeleniumBase Demo Mode" title="SeleniumBase Test" /></a></p>
129129

130130
<a id="python_installation"></a>
131-
<h2><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Python Setup:</h2>
131+
<h2><img src="https://seleniumbase.io/cdn/img/python_logo.png" title="SeleniumBase" width="42" /> Python Setup:</h2>
132132

133133
🔵 Add **[Python](https://www.python.org/downloads/)** and **[Git](https://git-scm.com/)** to your System PATH.
134134

135135
🔵 Using a [Python virtual env](https://seleniumbase.io/help_docs/virtualenv_instructions/) is recommended.
136136

137137
<a id="install_seleniumbase"></a>
138-
<h2><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Install SeleniumBase:</h2>
138+
<h2><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Install SeleniumBase:</h2>
139139

140140
**You can install ``seleniumbase`` from [GitHub](https://github.com/seleniumbase/SeleniumBase) or [PyPI](https://pypi.org/project/seleniumbase/):**
141141

@@ -219,13 +219,15 @@ COMMANDS:
219219
Use "pytest" for running tests.
220220
```
221221
222-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Downloading web drivers:</h3>
222+
223+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Downloading web drivers:</h3>
223224
224225
✅ SeleniumBase automatically downloads web drivers as needed, such as ``chromedriver`` and ``geckodriver`` (Firefox).
225226
226227
✅ To manually download a webdriver, see [Console Scripts](https://seleniumbase.io/seleniumbase/console_scripts/ReadMe/) OR [Webdriver Installation](https://seleniumbase.io/help_docs/webdriver_installation/).
227228
228-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Running tests:</h3>
229+
230+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Running tests:</h3>
229231
230232
🔵 If you've cloned SeleniumBase, you can run tests from the [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) folder.
231233
@@ -271,7 +273,10 @@ class MyTestClass(BaseCase):
271273
272274
* By default, **[CSS Selectors](https://www.w3schools.com/cssref/css_selectors.asp)** are used for finding page elements.
273275
* If you're new to CSS Selectors, games like [CSS Diner](http://flukeout.github.io/) can help you learn.
274-
* Here are some common SeleniumBase methods that you might find in tests:
276+
* For more reading, [here's an advanced guide on CSS attribute selectors](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors).
277+
278+
279+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Here are some common SeleniumBase methods that you might find in tests:</h3>
275280
276281
```python
277282
self.open(url) # Navigate the browser window to the URL.
@@ -310,7 +315,7 @@ self.assert_no_js_errors() # Verify there are no JS errors.
310315
311316
🔵 For the complete list of SeleniumBase methods, see: <b><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md">Method Summary</a></b>
312317
313-
<h2><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Learn More:</h2>
318+
<h2><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Learn More:</h2>
314319
315320
✅ Automatic WebDriver Abilities:
316321
<p>SeleniumBase automatically handles common WebDriver actions such as spinning up web browsers and saving screenshots during test failures. (<i><a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/customizing_test_runs.md">Read more about customizing test runs</a>.</i>)</p>
@@ -351,7 +356,7 @@ nosetests [FILE_NAME.py]:[CLASS_NAME].[METHOD_NAME]
351356
352357
353358
<a id="detailed_instructions"></a>
354-
<h2><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Detailed Instructions:</h2>
359+
<h2><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Detailed Instructions:</h2>
355360
356361
<a id="seleniumbase_demo_mode"></a>
357362
🔵 You can use **Demo Mode** to help you see what a test is doing: If a test is moving too fast for your eyes, run it in **Demo Mode** by adding ``--demo`` on the command-line, which pauses the browser briefly between actions, highlights page elements being acted on, and displays assertions:
@@ -498,7 +503,7 @@ Here's the command-line option to add to tests: (See [examples/custom_settings.p
498503
Inside your tests, you can use ``self.data`` to access that.
499504
500505
501-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Test Directory Configuration:</h3>
506+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Test Directory Configuration:</h3>
502507
503508
🔵 When running tests with **pytest**, you'll want a copy of **[pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini)** in your root folders. When running tests with **nosetests**, you'll want a copy of **[setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg)** in your root folders. These files specify default configuration details for tests. Folders should also include a blank ``__init__.py`` file, which allows your tests to import files from that folder.
504509
@@ -554,7 +559,7 @@ Of those files, the ``pytest.ini`` config file is the most important, followed b
554559
555560
--------
556561
557-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Log files from failed tests:</h3>
562+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Log files from failed tests:</h3>
558563
559564
Let's try an example of a test that fails:
560565
@@ -579,7 +584,7 @@ pytest test_fail.py
579584
580585
--------
581586
582-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> The SeleniumBase Dashboard:</h3>
587+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> The SeleniumBase Dashboard:</h3>
583588
584589
🔵 The ``--dashboard`` option for pytest generates a SeleniumBase Dashboard located at ``dashboard.html``, which updates automatically as tests run and produce results. Example:
585590
@@ -608,7 +613,7 @@ pytest test_suite.py --dashboard --rs --headless
608613
--------
609614
610615
<a id="creating_visual_reports"></a>
611-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Creating Visual Test Reports:</h3>
616+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Creating Visual Test Reports:</h3>
612617
613618
<h4><b>Pytest Reports:</b></h4>
614619
@@ -683,7 +688,7 @@ pytest test_suite.py --alluredir=allure_results
683688
```
684689
685690
686-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Using a Proxy Server:</h3>
691+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Using a Proxy Server:</h3>
687692
688693
If you wish to use a proxy server for your browser tests (Chromium or Firefox), you can add ``--proxy=IP_ADDRESS:PORT`` as an argument on the command line.
689694
@@ -712,7 +717,7 @@ pytest proxy_test.py --proxy=proxy1
712717
```
713718
714719
715-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Changing the User-Agent:</h3>
720+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Changing the User-Agent:</h3>
716721
717722
🔵 If you wish to change the User-Agent for your browser tests (Chromium and Firefox only), you can add ``--agent="USER AGENT STRING"`` as an argument on the command-line.
718723
@@ -721,21 +726,21 @@ pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1
721726
```
722727
723728
724-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Handling Pop-Up / Pop Up Alerts:</h3>
729+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Handling Pop-Up / Pop Up Alerts:</h3>
725730
726731
🔵 <code>self.accept_alert()</code> automatically waits for and accepts alert pop-ups. <code>self.dismiss_alert()</code> automatically waits for and dismisses alert pop-ups. On occasion, some methods like <code>self.click(SELECTOR)</code> might dismiss a pop-up on its own because they call JavaScript to make sure that the <code>readyState</code> of the page is <code>complete</code> before advancing. If you're trying to accept a pop-up that got dismissed this way, use this workaround: Call <code>self.find_element(SELECTOR).click()</code> instead, (which will let the pop-up remain on the screen), and then use <code>self.accept_alert()</code> to accept the pop-up (<a href="https://github.com/seleniumbase/SeleniumBase/issues/600#issuecomment-647270426">more on that here</a>). If pop-ups are intermittent, wrap code in a try/except block.
727732
728733
729-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Building Guided Tours for Websites:</h3>
734+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Building Guided Tours for Websites:</h3>
730735
731736
🔵 Learn about <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md">SeleniumBase Interactive Walkthroughs</a> (in the ``examples/tour_examples/`` folder). It's great for prototyping a website onboarding experience.
732737
733738
734739
<a id="utilizing_advanced_features"></a>
735-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Production Environments & Integrations:</h3>
740+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Production Environments & Integrations:</h3>
736741
737742
<details>
738-
<summary> (expand) ▶️ Here are some things you can do to set up a production environment for your testing.</summary>
743+
<summary> ▶️ Here are some things you can do to set up a production environment for your testing. (click to expand)</summary>
739744
740745
<ul>
741746
<li>You can set up a <a href="https://jenkins.io/">Jenkins</a> build server for running tests at regular intervals. For a real-world Jenkins example of headless browser automation in action, check out the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/jenkins/ReadMe.md">SeleniumBase Jenkins example on Azure</a> or the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/google_cloud/ReadMe.md">SeleniumBase Jenkins example on Google Cloud</a>.</li>
@@ -759,7 +764,7 @@ pytest [YOUR_TEST_FILE.py] --with-db-reporting --with-s3-logging
759764
760765
761766
<a id="detailed_method_specifications"></a>
762-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Detailed Method Specifications and Examples:</h3>
767+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Detailed Method Specifications and Examples:</h3>
763768
764769
🔵 Navigating to a web page: (and related commands)
765770
@@ -904,7 +909,7 @@ def is_there_a_cloaked_klingon_ship_on_this_page():
904909
```
905910
906911
<details>
907-
<summary> (expand) ▶️ is_text_visible(text, selector) # is text visible on a page</summary>
912+
<summary> ▶️ is_text_visible(text, selector) # is text visible on a page (click to expand)</summary>
908913
909914
```python
910915
def get_mirror_universe_captain_picard_superbowl_ad(superbowl_year):
@@ -969,7 +974,7 @@ self.activate_jquery()
969974
```
970975
971976
<details>
972-
<summary> (expand) ▶️ Here are some examples of using jQuery in your scripts.</summary>
977+
<summary> ▶️ Here are some examples of using jQuery in your scripts. (click to expand)</summary>
973978
974979
```python
975980
self.execute_script("jQuery, window.scrollTo(0, 600)") # Scrolling the page
@@ -998,7 +1003,7 @@ self.execute_script("return jQuery('textarea')[2].value") # Returns the css "va
9981003
🔵 Some websites have a restrictive [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) to prevent users from loading jQuery and other external libraries onto their websites. If you need to use jQuery or another JS library on such a website, add ``--disable-csp`` on the command-line.
9991004
10001005
<details>
1001-
<summary> (expand) ▶️ In this example, JavaScript creates a referral button on a page, which is then clicked.</summary>
1006+
<summary> ▶️ In this example, JavaScript creates a referral button on a page, which is then clicked. (click to expand)</summary>
10021007
10031008
```python
10041009
start_page = "https://xkcd.com/465/"
@@ -1060,7 +1065,7 @@ pytest --reruns=1 --reruns-delay=1
10601065
<p>Additionally, you can use the <code>@retry_on_exception()</code> decorator to specifically retry failing methods. (First import: <code>from seleniumbase import decorators</code>) To learn more about SeleniumBase decorators, [click here](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/common).</p>
10611066
10621067
1063-
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Wrap-Up</h3>
1068+
<h3><img src="https://seleniumbase.io/img/green_logo2.png" title="SeleniumBase" width="32" /> Wrap-Up</h3>
10641069
10651070
<b>Congratulations on getting started with SeleniumBase!</b>
10661071
@@ -1087,5 +1092,3 @@ pytest --reruns=1 --reruns-delay=1
10871092
</div></p>
10881093
10891094
<a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://seleniumbase.io/cdn/img/super_logo_sb.png" alt="SeleniumBase" title="SeleniumBase" width="200" /></a>
1090-
1091-
<p><b>Build all the automation you want, with SeleniumBase.</b></p>

0 commit comments

Comments
 (0)