Esempio n. 1
0
def test_inject_call():
    def foo(a, b, c=2):
        return a * 100 + b * 10 + c

    ret = utils.inject_call(foo, a=2, b=4)
    assert ret == 242

    with pytest.raises(TypeError):
        utils.inject_call(foo, 2)
Esempio n. 2
0
 def click(self, timeout=None):
     """ find element and perform click """
     try:
         el = self.get(timeout=timeout)
         el.click()
     except XPathElementNotFoundError:
         if not self._fallback:
             raise
         self.logger.info("element not found, run fallback")
         return inject_call(self._fallback, d=self._d)