lundi 28 septembre 2015

selenium webdriver "is_element_present" is the same as "driver.find_element_by~"?

I'm writting tests in unittest webdriver selenium

What's the point of using is_element_present instead of just "find_element_by~" if it contains it already?

def is_element_present(self, how, what):
        try: self.driver.find_element(by=how, value=what)
        except NoSuchElementException, e: return False
        return True

I mean whenever i use 'is_element_present' it goes through 'find_element_by~' anyway so whats the point of it?

This and this gives me the same exception if occured so whats the difference?

Aucun commentaire:

Enregistrer un commentaire