Skip to content

Commit a409afd

Browse files
committed
Update the ReadMe
1 parent b09e771 commit a409afd

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -726,29 +726,29 @@ self.click("a.analytics") # Clicks the generated button
726726
```
727727
(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.)
728728

729-
<h4>Using delayed asserts:</h4>
729+
<h4>Using deferred asserts:</h4>
730730

731-
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:
731+
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 deferred asserts come in. Here's the example:
732732

733733
```python
734734
from seleniumbase import BaseCase
735735

736736
class MyTestClass(BaseCase):
737737

738-
def test_delayed_asserts(self):
738+
def test_deferred_asserts(self):
739739
self.open('https://xkcd.com/993/')
740740
self.wait_for_element('#comic')
741-
self.delayed_assert_element('img[alt="Brand Identity"]')
742-
self.delayed_assert_element('img[alt="Rocket Ship"]') # Will Fail
743-
self.delayed_assert_element('#comicmap')
744-
self.delayed_assert_text('Fake Item', '#middleContainer') # Will Fail
745-
self.delayed_assert_text('Random', '#middleContainer')
746-
self.delayed_assert_element('a[name="Super Fake !!!"]') # Will Fail
747-
self.process_delayed_asserts()
741+
self.deferred_assert_element('img[alt="Brand Identity"]')
742+
self.deferred_assert_element('img[alt="Rocket Ship"]') # Will Fail
743+
self.deferred_assert_element('#comicmap')
744+
self.deferred_assert_text('Fake Item', '#middleContainer') # Will Fail
745+
self.deferred_assert_text('Random', '#middleContainer')
746+
self.deferred_assert_element('a[name="Super Fake !!!"]') # Will Fail
747+
self.process_deferred_asserts()
748748
```
749749

750-
``delayed_assert_element()`` and ``delayed_assert_text()`` will save any exceptions that would be raised.
751-
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.
750+
``deferred_assert_element()`` and ``deferred_assert_text()`` will save any exceptions that would be raised.
751+
To flush out all the failed deferred asserts into a single exception, make sure to call ``self.process_deferred_asserts()`` at the end of your test method. If your test hits multiple pages, you can call ``self.process_deferred_asserts()`` before navigating to a new page so that the screenshot from your log files matches the URL where the deferred asserts were made.
752752

753753
<h4>Accessing raw WebDriver</h4>
754754

0 commit comments

Comments
 (0)