With reference to this question https://sqa.stackexchange.com/questions/3481/quicker-way-to-assert-that-an-element-does-not-exist I'm trying to write an element_is_not_present
helper function:
def element_is_not_present(selector):
self.d.implicitly_wait(0)
number_present = len(self.d.find_elements_by_css_selector(selector))
self.d.implicitly_wait(10)
return number_present == 0
find_elements_by_css_selector
will wait for the implicit wait to timeout before returning so I have added mutators before and after the call to speed up the method. The issue comes in restoring the implicit wait, apparently there is no getter for the implicit wait value, so I must hard code the restore value causing issues when using a different base values.
The question is, how can I speed up my method whilst negating this issue? Failing this, maybe there is another way of writing the helper method or dealing with the explicit wait?
My current solution is to use my own implicit wait default value global but this is far from ideal.