''Customize' short test summary info pytest
I'm starting to learn automated testing. When I run a test I want to get a specific text ('No Add to Cart button') on error of selenium NoSuchElementException
I'm trying smth of that:
class TestCart:
def test_check_btn(self, browser):
browser.get(link)
browser.implicitly_wait(5)
assert browser.find_element(by=By.CSS_SELECTOR, value='.no-such-btn') is not None, 'No Add to Cart button'
Here is an actual log
=============================================================================== short test summary info ===============================================================================
FAILED test_cart/test_items.py::TestCart::test_check_btn - selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css sele...
How can I replace the error message with what I want?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|