'How to force a test to fail with selenium and python?
I was searching for a way to do this a lot of times but I didn't find any solution.
I'll show you what I mean:
def test_288_try_this(self):
try:
do_something()
except NoSuchElementException:
self.assertTrue(False, "This test fails bigger than you.")
I'm doing it that way, Of course is working buy I feel is not the correct way. I'd like to know if there is any kind of "self.assertFail(fail_message)" or some like that.
Thanks!
Solution 1:[1]
Python: If you want to verify whether the particular web element is present on a page after navigation. You can use the below method. self.assertTrue(element, msg='Element name is not present after naviagting to x page')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Srinivas |
