#NEWLINE# def find_element_by_locator( self , locator ) : #NEWLINE# #INDENT# locator_type = locator [ : locator . find ( '=' ) ] #NEWLINE# if ( locator_type == '' ) : #NEWLINE# #INDENT# raise saunter . exceptions . InvalidLocatorString ( locator ) #NEWLINE# #UNINDENT# locator_value = locator [ ( locator . find ( '=' ) + 1 ) : ] #NEWLINE# if ( locator_type == 'class' ) : #NEWLINE# #INDENT# return WebElement ( self . find_element_by_class_name ( locator_value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( locator_type == 'css' ) : #NEWLINE# #INDENT# return WebElement ( self . find_element_by_css_selector ( locator_value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( locator == 'id' ) : #NEWLINE# #INDENT# return WebElement ( self . find_element_by_id ( locator_value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( locator_type == 'link' ) : #NEWLINE# #INDENT# return WebElement ( self . find_element_by_link_text ( locator_value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( locator_type == 'name' ) : #NEWLINE# #INDENT# return WebElement ( self . find_element_by_name ( locator_value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( locator_type == 'plink' ) : #NEWLINE# #INDENT# return WebElement ( self . find_element_by_partial_link_text ( locator_value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( locator_type == 'tag' ) : #NEWLINE# #INDENT# return WebElement ( self . find_element_by_tag_name ( locator_value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( locator_type == 'xpath' ) : #NEWLINE# #INDENT# return WebElement ( self . find_element_by_xpath ( locator_value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise saunter . exceptions . InvalidLocatorString ( locator )