<s> from functools import partial <EOL> from selenium . webdriver . common . action_chains import ActionChains <EOL> from selenium . webdriver . support import expected_conditions as ec <EOL> from selenium . webdriver . support . wait import WebDriverWait <EOL> class WaitingActionChains ( ActionChains ) : <EOL> """<STR_LIT>""" <EOL> def wait ( self , timeout , condition = None , name = None , args = None ) : <EOL> """<STR_LIT>""" <EOL> if args is None : <EOL> args = [ ] <EOL> if name : <EOL> condition = getattr ( ec , name ) ( * args ) <EOL> if condition is None : <EOL> raise ValueError ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> def do_wait ( condition ) : <EOL> return WebDriverWait ( self . _driver , timeout ) . until ( condition ) <EOL> self . _actions . append ( partial ( do_wait , condition ) ) <EOL> return self </s>
