Skip to content

Commit d901ea2

Browse files
committed
Update the docs
1 parent 82e03bc commit d901ea2

File tree

10 files changed

+49
-43
lines changed

10 files changed

+49
-43
lines changed

README.md

Lines changed: 38 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<p align="center"><div align="center"><img src="https://cdn2.hubspot.net/hubfs/100006/images/swag_labs_gif.gif" alt="SeleniumBase" title="SeleniumBase" /></div></p>
4343

4444
<a id="python_installation"></a>
45-
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Get Started
45+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Get Started:</h2>
4646

4747
* Requires **[Python](https://www.python.org/downloads/)** and **[Git](https://git-scm.com/)**
4848
* [<img src="https://img.shields.io/pypi/pyversions/seleniumbase.svg?color=22AAEE" alt="Python:2.7|3.5|3.6|3.7|3.8" />](https://www.python.org/downloads/)
@@ -53,7 +53,7 @@ python -m pip install -U pip
5353
```
5454

5555
<a id="install_seleniumbase"></a>
56-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Install ``seleniumbase``:
56+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Install SeleniumBase:</h2>
5757
```bash
5858
git clone https://github.com/seleniumbase/SeleniumBase.git
5959
cd SeleniumBase/
@@ -69,7 +69,7 @@ pip install seleniumbase
6969
* Add ``--upgrade`` OR ``-U`` to upgrade an installation.
7070
* Add ``--force-reinstall`` to also upgrade dependencies.
7171

72-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Download a webdriver:
72+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Download a webdriver:</h3>
7373

7474
SeleniumBase can download a webdriver to the [seleniumbase/drivers](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/drivers) folder with the ``install`` command:
7575
```bash
@@ -81,7 +81,7 @@ seleniumbase install chromedriver
8181
seleniumbase install chromedriver latest
8282
```
8383

84-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Run a test on Chrome:
84+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Run a test on Chrome:</h3>
8585
```bash
8686
cd examples/
8787
pytest my_first_test.py
@@ -328,7 +328,7 @@ To pass additional data from the command-line to tests, add ``--data="ANY STRING
328328
Now inside your tests, you can use ``self.data`` to access that.
329329

330330

331-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Test Directory Customization:
331+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Test Directory Customization:</h3>
332332

333333
For running tests outside of the SeleniumBase repo with **Pytest**, you'll want a copy of **[pytest.ini](https://github.com/seleniumbase/SeleniumBase/blob/master/pytest.ini)** on the root folder. For running tests outside of the SeleniumBase repo with **Nosetests**, you'll want a copy of **[setup.cfg](https://github.com/seleniumbase/SeleniumBase/blob/master/setup.cfg)** on the root folder. (Subfolders should include a blank ``__init__.py`` file.) These files specify default configuration details for tests. (For nosetest runs, you can also specify a .cfg file by using ``--config``. Example ``nosetests [MY_TEST].py --config=[MY_CONFIG].cfg``)
334334

@@ -340,7 +340,7 @@ pytest my_first_test.py
340340
```
341341

342342

343-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Logging / Results from Failing Tests:
343+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Logging / Results from Failing Tests:</h3>
344344

345345
Let's try an example of a test that fails:
346346
```python
@@ -363,11 +363,11 @@ You'll notice that a logs folder, "latest_logs", was created to hold information
363363

364364

365365
<a id="creating_visual_reports"></a>
366-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Creating Visual Test Suite Reports:
366+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Creating Visual Test Suite Reports:</h3>
367367

368368
(NOTE: Several command-line args are different for Pytest vs Nosetests)
369369

370-
#### **Pytest Reports:**
370+
<h4><b>Pytest Reports:</b></h4>
371371

372372
Using ``--html=report.html`` gives you a fancy report of the name specified after your test suite completes.
373373
```bash
@@ -381,7 +381,7 @@ You can also use ``--junit-xml=report.xml`` to get an xml report instead. Jenkin
381381
pytest test_suite.py --junit-xml=report.xml
382382
```
383383

384-
#### **Nosetest Reports:**
384+
<h4><b>Nosetest Reports:</b></h4>
385385

386386
The ``--report`` option gives you a fancy report after your test suite completes.
387387
```bash
@@ -392,7 +392,7 @@ nosetests test_suite.py --report
392392
(NOTE: You can add ``--show-report`` to immediately display Nosetest reports after the test suite completes. Only use ``--show-report`` when running tests locally because it pauses the test run.)
393393

394394

395-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Using a Proxy Server:
395+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Using a Proxy Server:</h3>
396396

397397
If you wish to use a proxy server for your browser tests (Chrome and Firefox only), you can add ``--proxy=IP_ADDRESS:PORT`` as an argument on the command-line.
398398
```bash
@@ -410,21 +410,21 @@ pytest proxy_test.py --proxy=proxy1
410410
```
411411

412412

413-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Changing the User-Agent:
413+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Changing the User-Agent:</h3>
414414

415415
If you wish to change the User-Agent for your browser tests (Chrome and Firefox only), you can add ``--agent="USER AGENT STRING"`` as an argument on the command-line.
416416
```bash
417417
pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1.7412.EU"
418418
```
419419

420420

421-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Building Guided Tours for Websites:
421+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Building Guided Tours for Websites:</h3>
422422

423423
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.
424424

425425

426426
<a id="utilizing_advanced_features"></a>
427-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Production Environments & Integrations:
427+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Production Environments & Integrations:</h3>
428428

429429
Here are some things you can do to setup a production environment for your testing:
430430

@@ -444,9 +444,9 @@ pytest [YOUR_TEST_FILE].py --with-db-reporting --with-s3-logging
444444
```
445445

446446
<a id="detailed_method_specifications"></a>
447-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Detailed Method Specifications and Examples:
447+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Detailed Method Specifications and Examples:</h3>
448448

449-
#### Navigating to a web page (and related commands)
449+
<h4>Navigating to a web page (and related commands)</h4>
450450

451451
```python
452452
self.open("https://xkcd.com/378/") # This method opens the specified page.
@@ -470,7 +470,7 @@ head_close_tag = source.find('</head>', head_open_tag)
470470
everything_inside_head = source[head_open_tag+len('<head>'):head_close_tag]
471471
```
472472

473-
#### Clicking
473+
<h4>Clicking</h4>
474474

475475
To click an element on the page:
476476
```python
@@ -479,7 +479,7 @@ self.click("div#my_id")
479479

480480
**ProTip™:** In most web browsers, you can right-click on a page and select ``Inspect Element`` to see the CSS selector details that you'll need to create your own scripts.
481481

482-
#### Typing Text
482+
<h4>Typing Text</h4>
483483

484484
self.update_text(selector, text) # updates the text from the specified element with the specified value. An exception is raised if the element is missing or if the text field is not editable. Example:
485485
```python
@@ -493,23 +493,27 @@ from selenium.webdriver.common.keys import Keys
493493
self.find_element("textarea").send_keys(Keys.SPACE + Keys.BACK_SPACE + '\n') # The backspace should cancel out the space, leaving you with the newline
494494
```
495495

496-
#### Getting the text from an element on a page
496+
<h4>Getting the text from an element on a page</h4>
497+
497498
```python
498499
text = self.get_text("header h2")
499500
```
500501

501-
#### Getting the attribute value from an element on a page
502+
<h4>Getting the attribute value from an element on a page</h4>
503+
502504
```python
503505
attribute = self.get_attribute("#comic img", "title")
504506
```
505507

506-
#### Asserting existance of an element on a page within some number of seconds:
508+
<h4>Asserting existance of an element on a page within some number of seconds:</h4>
509+
507510
```python
508511
self.wait_for_element_present("div.my_class", timeout=10)
509512
```
510513
(NOTE: You can also use: ``self.assert_element_present(ELEMENT)``)
511514

512-
#### Asserting visibility of an element on a page within some number of seconds:
515+
<h4>Asserting visibility of an element on a page within some number of seconds:</h4>
516+
513517
```python
514518
self.wait_for_element_visible("a.my_class", timeout=5)
515519
```
@@ -531,21 +535,23 @@ You can also use ``*=`` to search for any partial value in a CSS selector as sho
531535
self.click('a[name*="partial_name"]')
532536
```
533537

534-
#### Asserting visibility of text inside an element on a page within some number of seconds:
538+
<h4>Asserting visibility of text inside an element on a page within some number of seconds:</h4>
539+
535540
```python
536541
self.assert_text("Make it so!", "div#trek div.picard div.quotes")
537542
self.assert_text("Tea. Earl Grey. Hot.", "div#trek div.picard div.quotes", timeout=3)
538543
```
539544
(NOTE: ``self.find_text(TEXT, ELEMENT)`` and ``self.wait_for_text(TEXT, ELEMENT)`` also do this. For backwords compatibility, older method names were kept, but the default timeout may be different.)
540545

541-
#### Asserting Anything
546+
<h4>Asserting Anything</h4>
547+
542548
```python
543549
self.assert_true(myvar1 == something)
544550

545551
self.assert_equal(var1, var2)
546552
```
547553

548-
#### Useful Conditional Statements (with creative examples in action)
554+
<h4>Useful Conditional Statements (with creative examples in action)</h4>
549555

550556
is_element_visible(selector) # is an element visible on a page
551557
```python
@@ -593,7 +599,7 @@ def get_mirror_universe_captain_picard_superbowl_ad(superbowl_year):
593599
raise Exception("Reports of my assimilation are greatly exaggerated.")
594600
```
595601

596-
#### Switching Tabs
602+
<h4>Switching Tabs</h4>
597603

598604
What if your test opens up a new tab/window and now you have more than one page? No problem. You need to specify which one you currently want Selenium to use. Switching between tabs/windows is easy:
599605
```python
@@ -608,7 +614,7 @@ self.switch_to_frame('ContentManagerTextBody_ifr')
608614
self.switch_to_default_content() # Exit the iFrame when you're done
609615
```
610616

611-
#### Handle Pop-Up Alerts
617+
<h4>Handling Pop-Up Alerts</h4>
612618

613619
What if your test makes an alert pop up in your browser? No problem. You need to switch to it and either accept it or dismiss it:
614620
```python
@@ -619,7 +625,7 @@ self.wait_for_and_dismiss_alert()
619625

620626
If you're not sure whether there's an alert before trying to accept or dismiss it, one way to handle that is to wrap your alert-handling code in a try/except block. Other methods such as .text and .send_keys() will also work with alerts.
621627

622-
#### Executing Custom jQuery Scripts:
628+
<h4>Executing Custom jQuery Scripts:</h4>
623629

624630
jQuery is a powerful JavaScript library that allows you to perform advanced actions in a web browser.
625631
If the web page you're on already has jQuery loaded, you can start executing jQuery scripts immediately.
@@ -667,7 +673,7 @@ self.click("a.analytics") # Clicks the generated button
667673
```
668674
(Due to popular demand, this traffic generation example has been baked into SeleniumBase with the ``self.generate_referral(start_page, end_page)`` and the ``self.generate_traffic(start_page, end_page, loops)`` methods.)
669675

670-
#### Using delayed asserts:
676+
<h4>Using delayed asserts:</h4>
671677

672678
Let's say you want to verify multiple different elements on a web page in a single test, but you don't want the test to fail until you verified several elements at once so that you don't have to rerun the test to find more missing elements on the same page. That's where delayed asserts come in. Here's the example:
673679
```python
@@ -690,7 +696,7 @@ class MyTestClass(BaseCase):
690696
``delayed_assert_element()`` and ``delayed_assert_text()`` will save any exceptions that would be raised.
691697
To flush out all the failed delayed asserts into a single exception, make sure to call ``self.process_delayed_asserts()`` at the end of your test method. If your test hits multiple pages, you can call ``self.process_delayed_asserts()`` at the end of all your delayed asserts for a single page. This way, the screenshot from your log file will have the location where the delayed asserts were made.
692698

693-
#### Accessing raw WebDriver
699+
<h4>Accessing raw WebDriver</h4>
694700

695701
If you need access to any commands that come with standard WebDriver, you can call them directly like this:
696702
```python
@@ -700,7 +706,7 @@ self.driver.find_elements_by_partial_link_text("GitHub")
700706
```
701707
(In general, you'll want to use the SeleniumBase versions of methods when available.)
702708

703-
#### Retrying failing tests automatically
709+
<h4>Retrying failing tests automatically</h4>
704710

705711
You can use ``--reruns NUM`` to retry failing tests that many times. Use ``--reruns-delay SECONDS`` to wait that many seconds between retries. Example:
706712
```
@@ -710,9 +716,9 @@ pytest --reruns 5 --reruns-delay 1
710716
Additionally, you can use the ``@retry_on_exception()`` decorator to specifically retry failing methods. (First import: ``from seleniumbase import decorators``) To learn more about SeleniumBase decorators, [click here](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/common).
711717

712718

713-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Wrap-Up
719+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Wrap-Up</h3>
714720

715-
#### Congratulations on getting started with SeleniumBase!
721+
<b>Congratulations on getting started with SeleniumBase!</b>
716722

717723
<p>
718724
<div><b>If you see something, say something!</b></div>

examples/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center"><a align="center" href="https://github.com/seleniumbase/SeleniumBase/blob/master/README.md"><img align="center" src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb8.png" alt="SeleniumBase" width="290" /></a></p>
22

3-
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Running Example Tests:
3+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Running Example Tests:</h2>
44

55
SeleniumBase tests are run with **``pytest``**. Chrome is the default browser if not specifed. During test failures, logs and screenshots from the latest run are saved to the ``latest_logs/`` folder.
66

examples/translations/ReadMe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<h3 align="left"><a href="https://github.com/seleniumbase/SeleniumBase/"><img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_m.png" title="SeleniumBase" width="290" /></a></h3>
22

33
<a id="language_tests"></a>
4-
### <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Language Tests (Python 3+)
4+
<h3><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Language Tests (Python 3+)</h3>
55

66
<b>SeleniumBase</b> supports the following 10 languages:
77
<ul>
@@ -27,7 +27,7 @@ self.뒤로() = self.go_back()
2727
```
2828

2929
<a id="translation_api"></a>
30-
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Translation API
30+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Translation API</h2>
3131

3232
You can use SeleniumBase to selectively translate the method names of any test from one language to another via the console scripts interface. Additionally, the ``import`` line at the top of the Python file will change to import the new ``BaseCase``. Example: ``BaseCase`` becomes ``CasoDeTeste`` when a test is translated into Portuguese.
3333

help_docs/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div><a href="https://github.com/seleniumbase/SeleniumBase"><img src="https://cdn2.hubspot.net/hubfs/100006/images/sb_media_logo.png" alt="SeleniumBase" width="240" /></a></div>
22

3-
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Help Documents
3+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Help Documents</h2>
44

55
<h3>Table of Contents (<a href="https://seleniumbase.io">seleniumbase.io</a>)</h3>
66

help_docs/customizing_test_runs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb.png" title="SeleniumBase" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

3-
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Customizing test runs
3+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Customizing test runs</h2>
44

55
You can customize test runs from the command-line thanks to [SeleniumBase's pytest plugin](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py), which adds command-line options for setting/enabling the browser type, headless mode, mobile mode, multithreading mode, demo mode, proxy config, user agent config, browser extensions, and more.
66

help_docs/features_list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<p>(<b><a href="https://www.youtube.com/watch?v=Sjzq9kU5kOw">Watch the tutorial on YouTube</a></b>)</p>
55

66
<a id="feature_list"></a>
7-
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> **Features:**
7+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Features:</h2>
88
* A complete test automation framework for web/mobile UI testing.
99
* Uses [pytest](https://docs.pytest.org/en/latest/), [unittest](https://docs.python.org/3/library/unittest.html), and [nose](http://nose.readthedocs.io/en/latest/) for test discovery and execution.
1010
* No more flaky tests! (Smart-waiting code keeps tests reliable.)

help_docs/how_it_works.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/super_logo_sb4.png" title="SeleniumBase" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
22

33
<a id="how_seleniumbase_works"></a>
4-
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> **How it works:**
4+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> How it works:</h2>
55

66
At the core, SeleniumBase works by extending [pytest](https://docs.pytest.org/en/latest/) as a direct plugin. SeleniumBase automatically spins up web browsers for tests, and then gives those tests access to the SeleniumBase libraries through the [BaseCase class](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/fixtures/base_case.py). Tests are also given access to [SeleniumBase command-line arguments](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/plugins/pytest_plugin.py) and [SeleniumBase methods](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/method_summary.md), which provide additional functionality.
77

help_docs/mobile_testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/SeleniumBaseText_F.png" title="SeleniumBase" align="center" width="290">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md)
2-
## <img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Mobile Testing
2+
<h2><img src="https://seleniumbase.io/img/sb_icon.png" title="SeleniumBase" width="30" /> Mobile Testing</h2>
33

44
Use ``--mobile`` to run your SeleniumBase tests using Chrome's (or Edge's) mobile device emulator with default values for device metrics (CSS Width, CSS Height, Pixel-Ratio) and user agent.
55

0 commit comments

Comments
 (0)