def switch_to_frame_of_element(self, selector, by=By.CSS_SELECTOR):
selector, by = self.__recalculate_selector(selector, by)<EOL>if self.is_element_present(selector, by=by):<EOL><INDENT>return None<EOL><DEDENT>soup = self.get_beautiful_soup()<EOL>iframe_list = soup.select('<STR_LIT>')<EOL>for iframe in iframe_list:<EOL><INDENT>iframe_identifier = None<EOL>if iframe.has_attr('<STR_LIT:name>') and len(iframe['<STR_LIT:name>']) > <NUM_LIT:0>:<EOL><INDENT>iframe_identifier = iframe['<STR_LIT:name>']<EOL><DEDENT>elif iframe.has_attr('<STR_LIT:id>') and len(iframe['<STR_LIT:id>']) > <NUM_LIT:0>:<EOL><INDENT>iframe_identifier = iframe['<STR_LIT:id>']<EOL><DEDENT>else:<EOL><INDENT>continue<EOL><DEDENT>self.switch_to_frame(iframe_identifier)<EOL>if self.is_element_present(selector, by=by):<EOL><INDENT>return iframe_identifier<EOL><DEDENT>self.switch_to_default_content()<EOL><DEDENT>return None<EOL>
Set driver control to the iframe of the element (assuming the
            element is in a single-nested iframe) and returns the iframe name.
            If element is not in an iframe, returns None, and nothing happens.
            May not work if multiple iframes are nested within each other.