原理-结论
查看until源码:(not_until同理)
1、由源码可知,until方法内部,说明是需要传入一个将driver 作为参数的方法。
2、继续查看源码: value = method(self.driver),method是输入参数可知:
a、传入参数 是一个将driver 作为参数的方法
b、传入参数 也可以是一个将driver 作为参数的lambda表达式
c、传入参数 也可以是一个 实现了__call_(self, driver),并把driver作为参数的类实例(这个和until的说明和初忠不同,但源码正常执行是没问题的)
d、_ignored_exceptions 是exception实现的,会捕捉所有异常
def __init__(self, driver, timeout, poll_frequency=POLL_FREQUENCY, ignored_exceptions=None):
"""Constructor, takes a WebDriver instance and timeout in seconds.
:Args:
- driver - Instance of WebDriver (Ie, Firefox, Chrome or Remote)
- timeout - Number of seconds before timing out
- poll_frequency - sleep interval between calls
By default, it is 0.5 second.
- ignored_exceptions - iterable structure of exception classes ignored during calls.
By default, it contains