<s> from webdriverplus . orderedset import OrderedSet <EOL> from webdriverplus . selectors import SelectorMixin <EOL> from webdriverplus . wrappers import Style , Attributes <EOL> from webdriverplus . deprecation import deprecated_property <EOL> class WebElementSet ( SelectorMixin , OrderedSet ) : <EOL> def __init__ ( self , webdriver , * args ) : <EOL> super ( WebElementSet , self ) . __init__ ( * args ) <EOL> self . _webdriver = webdriver <EOL> def _from_iterable ( self , it ) : <EOL> return WebElementSet ( self . _webdriver , it ) <EOL> def _empty ( self ) : <EOL> return WebElementSet ( self . _webdriver ) <EOL> def find ( self , css = None , ** kwargs ) : <EOL> ret = self . _empty ( ) <EOL> for elem in self : <EOL> ret |= elem . find ( css , ** kwargs ) <EOL> return ret <EOL> def filter ( self , css = None , ** kwargs ) : <EOL> if not css or kwargs : <EOL> return self <EOL> others = self . _webdriver . find ( css , ** kwargs ) <EOL> return self & others <EOL> def exclude ( self , css = None , ** kwargs ) : <EOL> others = self . _webdriver . find ( css , ** kwargs ) <EOL> return self - others <EOL> @ property <EOL> def tag_name ( self ) : <EOL> return self . _first . tag_name <EOL> @ property <EOL> def text ( self ) : <EOL> return self . _first . text <EOL> @ deprecated_property <EOL> def is_selected ( self ) : <EOL> return self . _first . is_selected ( ) <EOL> @ deprecated_property <EOL> def is_enabled ( self ) : <EOL> return self . _first . is_enabled ( ) <EOL> @ deprecated_property <EOL> def is_displayed ( self ) : <EOL> return self . _first . is_displayed ( ) <EOL> @ deprecated_property <EOL> def is_checked ( self ) : <EOL> return self . _first . is_checked ( ) <EOL> def click ( self ) : <EOL> self . _first . click ( ) <EOL> return self <EOL> def double_click ( self ) : <EOL> self . _first . double_click ( ) <EOL> return self <EOL> def context_click ( self ) : <EOL> self . _first . context_click ( ) <EOL> return self <EOL> def click_and_hold ( self ) : <EOL> self . _first . click_and_hold ( ) <EOL> return self <EOL> def release ( self ) : <EOL> self . _first . release ( ) <EOL> return self <EOL> def move_to ( self , x = <NUM_LIT:0> , y = <NUM_LIT:0> ) : <EOL> self . _first . move_to ( x , y ) <EOL> return self <EOL> def move_to_and_click ( self , * args , ** kwargs ) : <EOL> self . _first . move_to_and_click ( * args , ** kwargs ) <EOL> return self <EOL> def check ( self ) : <EOL> self . _first . check ( ) <EOL> return self <EOL> def uncheck ( self ) : <EOL> self . _first . uncheck ( ) <EOL> return self <EOL> def submit ( self ) : <EOL> self . _first . submit ( ) <EOL> return self <EOL> def clear ( self ) : <EOL> self . _first . clear ( ) <EOL> return self <EOL> def get_attribute ( self , name ) : <EOL> return self . _first . get_attribute ( name ) <EOL> def attr ( self , name ) : <EOL> return self . _first . attr ( name ) <EOL> def send_keys ( self , * value ) : <EOL> [ elem . send_keys ( * value ) for elem in self ] <EOL> return self <EOL> @ property <EOL> def type ( self ) : <EOL> return self . _first . type <EOL> @ property <EOL> def inner_html ( self ) : <EOL> return self . _first . inner_html <EOL> @ property <EOL> def html ( self ) : <EOL> return self . _first . html <EOL> @ property <EOL> def index ( self ) : <EOL> return self . _first . index <EOL> @ property <EOL> def value ( self ) : <EOL> return self . _first . value <EOL> @ value . setter <EOL> def value ( self , value ) : <EOL> self . _first . value = value <EOL> def value_of_css_property ( self , property_name ) : <EOL> return [ elem . value_of_css_property ( property_name ) for elem in self ] <EOL> @ property <EOL> def location ( self ) : <EOL> return self . _first . location <EOL> @ property <EOL> def size ( self ) : <EOL> return self . _first . size <EOL> @ property <EOL> def id ( self ) : <EOL> return self . _first . id <EOL> @ property <EOL> def style ( self ) : <EOL> return Style ( self . _first ) <EOL> @ property <EOL> def attributes ( self ) : <EOL> return Attributes ( self . _first ) <EOL> def has_class ( self , cls ) : <EOL> for elem in self : <EOL> if elem . has_class ( cls ) : <EOL> return True <EOL> return False <EOL> def css ( self , name , value = None ) : <EOL> return self . _first . css ( name , value ) <EOL> def javascript ( self , script ) : <EOL> return [ elem . javascript ( script ) for elem in self ] <EOL> def __repr__ ( self ) : <EOL> ret = "<STR_LIT>" % '<STR_LIT>' . join ( [ repr ( elem ) for elem in self ] ) <EOL> script = """<STR_LIT>""" <EOL> self . _webdriver . _highlight ( [ elem for elem in self ] ) <EOL> return ret <EOL> def parent ( self , * args , ** kwargs ) : <EOL> ret = self . _empty ( ) <EOL> for elem in self : <EOL> ret |= elem . parent ( ) <EOL> return ret . filter ( * args , ** kwargs ) <EOL> def children ( self , * args , ** kwargs ) : <EOL> ret = self . _empty ( ) <EOL> for elem in self : <EOL> ret |= elem . children ( ) <EOL> return ret . filter ( * args , ** kwargs ) <EOL> def descendants ( self ) : <EOL> ret = self . _empty ( ) <EOL> for elem in self : <EOL> ret |= elem . descendants ( ) <EOL> return ret <EOL> def ancestors ( self , * args , ** kwargs ) : <EOL> ret = self . _empty ( ) <EOL> for elem in self : <EOL> ret |= elem . ancestors ( ) <EOL> return ret . filter ( * args , ** kwargs ) <EOL> def next ( self , * args , ** kwargs ) : <EOL> ret = self . _empty ( ) <EOL> for elem in self : <EOL> ret |= elem . next ( ) <EOL> return ret . filter ( * args , ** kwargs ) <EOL> def prev ( self , * args , ** kwargs ) : <EOL> ret = self . _empty ( ) <EOL> for elem in self : <EOL> ret |= elem . prev ( ) <EOL> return ret . filter ( * args , ** kwargs ) <EOL> def next_all ( self , * args , ** kwargs ) : <EOL> ret = self . _empty ( ) <EOL> for elem in self : <EOL> ret |= elem . next_all ( ) <EOL> return ret . filter ( * args , ** kwargs ) <EOL> def prev_all ( self , * args , ** kwargs ) : <EOL> ret = self . _empty ( ) <EOL> for elem in self : <EOL> ret |= elem . prev_all ( ) <EOL> return ret . filter ( * args , ** kwargs ) <EOL> def siblings ( self , * args , ** kwargs ) : <EOL> ret = self . _empty ( ) <EOL> for elem in self : <EOL> ret |= elem . siblings ( ) <EOL> return ret . filter ( * args , ** kwargs ) <EOL> def type_keys ( self , * args ) : <EOL> return self . _first . type_keys ( * args ) <EOL> def select_option ( self , value = None , text = None , index = None ) : <EOL> return self . _first . select_option ( value = value , text = text , index = index ) <EOL> def deselect_option ( self , value = None , text = None , index = None ) : <EOL> return self . _first . deselect_option ( value = value , text = text , index = index ) <EOL> def __getitem__ ( self , key ) : <EOL> if isinstance ( key , slice ) : <EOL> elems = list ( self ) [ key ] <EOL> else : <EOL> elems = [ list ( self ) [ key ] ] <EOL> return WebElementSet ( self . _webdriver , elems ) </s>
