def __select_option(self, dropdown_selector, option,<EOL>dropdown_by=By.CSS_SELECTOR, option_by="<STR_LIT:text>",<EOL>timeout=settings.SMALL_TIMEOUT):
if page_utils.is_xpath_selector(dropdown_selector):<EOL><INDENT>dropdown_by = By.XPATH<EOL><DEDENT>element = self.find_element(<EOL>dropdown_selector, by=dropdown_by, timeout=timeout)<EOL>self.__demo_mode_highlight_if_active(dropdown_selector, dropdown_by)<EOL>pre_action_url = self.driver.current_url<EOL>try:<EOL><INDENT>if option_by == "<STR_LIT:index>":<EOL><INDENT>Select(element).select_by_index(option)<EOL><DEDENT>elif option_by == "<STR_LIT:value>":<EOL><INDENT>Select(element).select_by_value(option)<EOL><DEDENT>else:<EOL><INDENT>Select(element).select_by_visible_text(option)<EOL><DEDENT><DEDENT>except (StaleElementReferenceException, ENI_Exception):<EOL><INDENT>self.wait_for_ready_state_complete()<EOL>time.sleep(<NUM_LIT>)<EOL>element = self.find_element(<EOL>dropdown_selector, by=dropdown_by, timeout=timeout)<EOL>if option_by == "<STR_LIT:index>":<EOL><INDENT>Select(element).select_by_index(option)<EOL><DEDENT>elif option_by == "<STR_LIT:value>":<EOL><INDENT>Select(element).select_by_value(option)<EOL><DEDENT>else:<EOL><INDENT>Select(element).select_by_visible_text(option)<EOL><DEDENT><DEDENT>if settings.WAIT_FOR_RSC_ON_CLICKS:<EOL><INDENT>self.wait_for_ready_state_complete()<EOL><DEDENT>if self.demo_mode:<EOL><INDENT>if self.driver.current_url != pre_action_url:<EOL><INDENT>self.__demo_mode_pause_if_active()<EOL><DEDENT>else:<EOL><INDENT>self.__demo_mode_pause_if_active(tiny=True)<EOL><DEDENT><DEDENT>
Selects an HTML <select> option by specification.
            Option specifications are by "text", "index", or "value".
            Defaults to "text" if option_by is unspecified or unknown.