Question about asserting an UI Element

Hey Appium PPL :slight_smile:

First of all i would like to thank you for this awesome framework and this new awesome discussion portal.

Let me get to the chase, here’s my question: An example from the test scripts provided with Appium :

nav_bar = self.driver.find_element_by_class_name(“UIANavigationBar”)

My question is that in this specific part, and parts like these in everyone’s scripts, where we have to know if that element exists or not, is it really necessary to assert the element at all ? Isn’t the find_element an assertion in the first place ?
I mean for this specific case if the interpreter moves to the self.assertTrue line doesn’t that mean that the element already exists ?

Thanks in advance,


1 Like

In selenium, when searching for a single element an error is raised if not found.



1 Like